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(!data.contains("End file list")) SDFilesList.append(data);
|
||||
if(!data.contains("End file list")) SDFilesList.append(data.remove(data.size()-2, 2));
|
||||
else
|
||||
{
|
||||
readingFiles = false;
|
||||
|
||||
@ -7,7 +7,13 @@ SDWindow::SDWindow(QStringList files, QWidget *parent) :
|
||||
{
|
||||
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()
|
||||
|
||||
20
sdwindow.ui
20
sdwindow.ui
@ -6,10 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>249</width>
|
||||
<height>246</height>
|
||||
<width>274</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Print from SD</string>
|
||||
</property>
|
||||
@ -21,7 +27,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Print file:</string>
|
||||
<string>Select file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -40,8 +46,14 @@
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="fileslist">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoScroll">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user