Fixed crash in SD window
Fixed '\r\n' at the end of string and pressing "ok" with no selection
This commit is contained in:
parent
ecc6e5570d
commit
2d6d09743e
@ -29,7 +29,7 @@ void Parser::parse(QByteArray data)
|
|||||||
{
|
{
|
||||||
if(readingFiles) //SD files list reading mode
|
if(readingFiles) //SD files list reading mode
|
||||||
{
|
{
|
||||||
if(!data.contains("End file list")) SDFilesList.append(data);
|
if(!data.contains("End file list")) SDFilesList.append(data.remove(data.size()-2, 2));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readingFiles = false;
|
readingFiles = false;
|
||||||
|
|||||||
@ -7,7 +7,13 @@ SDWindow::SDWindow(QStringList files, QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
if(!files.isEmpty()) ui->fileslist->addItems(files);
|
ui->fileslist->setSelectionMode(QListView::SingleSelection);
|
||||||
|
|
||||||
|
if(!files.isEmpty())
|
||||||
|
{
|
||||||
|
ui->fileslist->addItems(files);
|
||||||
|
ui->fileslist->setCurrentItem(ui->fileslist->itemAt(0,0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDWindow::~SDWindow()
|
SDWindow::~SDWindow()
|
||||||
|
|||||||
20
sdwindow.ui
20
sdwindow.ui
@ -6,10 +6,16 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>249</width>
|
<width>274</width>
|
||||||
<height>246</height>
|
<height>302</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Print from SD</string>
|
<string>Print from SD</string>
|
||||||
</property>
|
</property>
|
||||||
@ -21,7 +27,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Print file:</string>
|
<string>Select file:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -40,8 +46,14 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QListWidget" name="fileslist">
|
<widget class="QListWidget" name="fileslist">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="autoScroll">
|
<property name="autoScroll">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user