Added message box about did not saved changes.
This commit is contained in:
parent
d28265b3dc
commit
0f5d2c0720
|
@ -155,6 +155,7 @@ void MainWindow::ActionNewDraw(){
|
||||||
VDrawTool::AddRecord(id, Tools::SinglePointTool, doc);
|
VDrawTool::AddRecord(id, Tools::SinglePointTool, doc);
|
||||||
SetEnableTool(true);
|
SetEnableTool(true);
|
||||||
SetEnableWidgets(true);
|
SetEnableWidgets(true);
|
||||||
|
changeInFile = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OptionDraw(){
|
void MainWindow::OptionDraw(){
|
||||||
|
@ -457,6 +458,41 @@ void MainWindow::showEvent( QShowEvent *event ){
|
||||||
isInitialized = true;//first show windows are held
|
isInitialized = true;//first show windows are held
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::closeEvent(QCloseEvent *event){
|
||||||
|
if(changeInFile == true){
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText("The pattern has been modified.");
|
||||||
|
msgBox.setInformativeText("Do you want to save your changes?");
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Save);
|
||||||
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
switch (ret) {
|
||||||
|
case QMessageBox::Save:
|
||||||
|
// Save was clicked
|
||||||
|
if(fileName.isEmpty()){
|
||||||
|
ActionSaveAs();
|
||||||
|
} else {
|
||||||
|
ActionSave();
|
||||||
|
}
|
||||||
|
event->accept();
|
||||||
|
break;
|
||||||
|
case QMessageBox::Discard:
|
||||||
|
// Don't Save was clicked
|
||||||
|
event->accept();
|
||||||
|
break;
|
||||||
|
case QMessageBox::Cancel:
|
||||||
|
// Cancel was clicked
|
||||||
|
event->ignore();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// should never be reached
|
||||||
|
event->accept();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::ToolBarOption(){
|
void MainWindow::ToolBarOption(){
|
||||||
QLabel * labelGrowth = new QLabel;
|
QLabel * labelGrowth = new QLabel;
|
||||||
labelGrowth->setText(tr("Growth: "));
|
labelGrowth->setText(tr("Growth: "));
|
||||||
|
|
|
@ -108,6 +108,7 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
virtual void keyPressEvent ( QKeyEvent * event );
|
virtual void keyPressEvent ( QKeyEvent * event );
|
||||||
virtual void showEvent( QShowEvent *event );
|
virtual void showEvent( QShowEvent *event );
|
||||||
|
virtual void closeEvent( QCloseEvent * event );
|
||||||
void Clear();
|
void Clear();
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user