Restore the maybe save warning.
This commit is contained in:
parent
edee237fb8
commit
2d68d40b59
|
@ -928,50 +928,42 @@ void VPMainWindow::WriteSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPMainWindow::MaybeSave()
|
auto VPMainWindow::MaybeSave() -> bool
|
||||||
{
|
{
|
||||||
// TODO: Implement maybe save check
|
// TODO: Implement maybe save check
|
||||||
// if (this->isWindowModified())
|
if (this->isWindowModified())
|
||||||
// {
|
{
|
||||||
// if (curFile.isEmpty() && ui->tableWidget->rowCount() == 0)
|
QScopedPointer<QMessageBox> messageBox(new QMessageBox(tr("Unsaved changes"),
|
||||||
// {
|
tr("Measurements have been modified.\n"
|
||||||
// return true;// Don't ask if file was created without modifications.
|
"Do you want to save your changes?"),
|
||||||
// }
|
QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No,
|
||||||
|
QMessageBox::Cancel, this, Qt::Sheet));
|
||||||
|
|
||||||
// QScopedPointer<QMessageBox> messageBox(new QMessageBox(tr("Unsaved changes"),
|
messageBox->setDefaultButton(QMessageBox::Yes);
|
||||||
// tr("Measurements have been modified.\n"
|
messageBox->setEscapeButton(QMessageBox::Cancel);
|
||||||
// "Do you want to save your changes?"),
|
|
||||||
// QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No,
|
|
||||||
// QMessageBox::Cancel, this, Qt::Sheet));
|
|
||||||
|
|
||||||
// messageBox->setDefaultButton(QMessageBox::Yes);
|
messageBox->setButtonText(QMessageBox::Yes, curFile.isEmpty() || lIsReadOnly ? tr("Save…") : tr("Save"));
|
||||||
// messageBox->setEscapeButton(QMessageBox::Cancel);
|
messageBox->setButtonText(QMessageBox::No, tr("Don't Save"));
|
||||||
|
|
||||||
// messageBox->setButtonText(QMessageBox::Yes, curFile.isEmpty() || mIsReadOnly ? tr("Save…") : tr("Save"));
|
messageBox->setWindowModality(Qt::ApplicationModal);
|
||||||
// messageBox->setButtonText(QMessageBox::No, tr("Don't Save"));
|
const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
|
||||||
|
|
||||||
// messageBox->setWindowModality(Qt::ApplicationModal);
|
switch (ret)
|
||||||
// const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
|
{
|
||||||
|
case QMessageBox::Yes:
|
||||||
// switch (ret)
|
if (lIsReadOnly)
|
||||||
// {
|
{
|
||||||
// case QMessageBox::Yes:
|
return on_actionSaveAs_triggered();
|
||||||
// if (mIsReadOnly)
|
}
|
||||||
// {
|
return on_actionSave_triggered();
|
||||||
// return FileSaveAs();
|
case QMessageBox::No:
|
||||||
// }
|
return true;
|
||||||
// else
|
case QMessageBox::Cancel:
|
||||||
// {
|
return false;
|
||||||
// return FileSave();
|
default:
|
||||||
// }
|
break;
|
||||||
// case QMessageBox::No:
|
}
|
||||||
// return true;
|
}
|
||||||
// case QMessageBox::Cancel:
|
|
||||||
// return false;
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,7 +544,7 @@ private:
|
||||||
void ReadSettings();
|
void ReadSettings();
|
||||||
void WriteSettings();
|
void WriteSettings();
|
||||||
|
|
||||||
bool MaybeSave();
|
auto MaybeSave() -> bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief generateTiledPdf Generates the tiled Pdf in the given filename
|
* @brief generateTiledPdf Generates the tiled Pdf in the given filename
|
||||||
|
|
Loading…
Reference in New Issue
Block a user