When user doesn't change current pattern piece name he must be able to close

the dialog by clicking on OK.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-01-16 19:22:18 +02:00
parent b43962d40d
commit 69364be0ee

View File

@ -4432,7 +4432,7 @@ void MainWindow::InitAutoSave()
//---------------------------------------------------------------------------------------------------------------------
QString MainWindow::PatternPieceName(const QString &text)
{
QInputDialog *dlg = new QInputDialog(this);
QScopedPointer<QInputDialog> dlg(new QInputDialog(this));
dlg->setInputMode( QInputDialog::TextInput );
dlg->setLabelText(tr("Pattern piece:"));
dlg->setTextEchoMode(QLineEdit::Normal);
@ -4444,17 +4444,16 @@ QString MainWindow::PatternPieceName(const QString &text)
{
const bool bOk = dlg->exec();
nameDraw = dlg->textValue();
if (bOk == false || nameDraw.isEmpty())
if (bOk == false || nameDraw.isEmpty() || text == nameDraw)
{
delete dlg;
return QString();
}
if (comboBoxDraws->findText(nameDraw) == -1)
{
break;//repeate show dialog
}
}
delete dlg;
return nameDraw;
}