bool Widget::windowShouldClose() { if (!isWindowModified()) return true; QMessageBox::StandardButton answer = QMessageBox::question( this, tr("Close Window"), tr("Really close the window?"), QMessageBox::Yes | QMessageBox::No ); return (answer == QMessageBox::Yes); }
bool MainWindow::okToContinue() { if(isWindowModified()) { int r = QMessageBox::warning(this, tr("RL-Dialog"), tr("Dieser Dialog wurde noch nicht gespeichert!.\n Willst du ihn jetzt speichern?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); if (r == QMessageBox::Yes) {return save(); } else if (r == QMessageBox::Cancel) { return false; } } return true; }
bool ImageWindow::okToContinue() { if (isWindowModified()) { int r = QMessageBox::warning(this, tr("Image Pro"), tr("The image has been modified.\n" "Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (r == QMessageBox::Yes) { return save(); } else if (r == QMessageBox::Cancel) { return false; } } return true; }
bool MainWindow::okToContinue() { if (isWindowModified()) { int r = QMessageBox::warning(this, tr("Spreadsheet"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (r == QMessageBox::Yes) { return save(); } else if (r == QMessageBox::Cancel) { return false; } } return true; }
bool MainWindow::maybeSave() { if (isWindowModified()) { QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("Application"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (ret == QMessageBox::Save) return on_actionSave_triggered(); else if (ret == QMessageBox::Cancel) return false; } return true; }
/** Okay to Continue Function * * Prompts the user if the user wants to continue leaving * the spreadsheet with unsaved changes. */ bool MainWindow::okToContinue() { if(isWindowModified()) { /* Parameters: Parent, Title, Message, Response buttons */ int r = QMessageBox::warning(this, tr("Spreadsheet"), tr("This document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if(r == QMessageBox::Yes) return save(); else if(r == QMessageBox::Cancel) return false; } return true; }
// check if the current single document is saved that ok to close bool PicEditWindow::okToClose(){ if (isWindowModified()) { int r = QMessageBox::warning(this, tr("PicEdit"), QFileInfo(*curFile).fileName() + tr("has been modified.\n Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (r == QMessageBox::Yes) { return save(); }else if (r == QMessageBox::No){ return true; }else if (r == QMessageBox::Cancel) { return false; } } return true; }
/*! Indicate whether the monofin has been modified. In the latter case, ask the user to save the changes made. */ bool Monofin::okToContinue() { if (isWindowModified()) { int r = QMessageBox::warning(this, tr("Monofin"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); if (r == QMessageBox::Yes) return save(); else if (r == QMessageBox::Cancel) return false; } return true; }
bool AmuWindow::saveToClose() { if (isWindowModified()) { int r = QMessageBox::warning(this, tr("Save changes"), tr("You have some changes.\n" "Do you want to save it?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (r == QMessageBox::Save) return on_actionSave_triggered(); else if (r == QMessageBox::Cancel) return false; } return true; }
bool MainWindow::askToSave() { if (isWindowModified()) { QMessageBox::StandardButton result; result = QMessageBox::warning(this, QApplication::applicationName(), tr("The game was modified.\nDo you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (result == QMessageBox::Save) return save(); else if (result == QMessageBox::Cancel) return false; } return true; }
void MainWindow::closeEvent(QCloseEvent *event) { if (isWindowModified()) { bool exit = QMessageBox::question(this, tr("Quit"), tr("Are you sure to quit this application?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes; if (exit) { event->accept(); } else { event->ignore(); } } else { event->accept(); } }
bool SdiWindow::isSafeToClose() { if (isWindowModified()) { switch (QMessageBox::warning(this, tr("SDI"), tr("The document has unsaved changes.\nDo you want to save it before it is closed?"), QMessageBox::Discard | QMessageBox::Cancel)) { case QMessageBox::Cancel: return false; default: return true; } } return true; }
bool MainWindow::okToContinue() { if (isWindowModified()) { int r = QMessageBox::warning(this, tr("slowmoUI"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (r == QMessageBox::Yes) { slotSaveProjectDialog(); return true; } else if (r == QMessageBox::Cancel) { return false; } } return true; }
void TitleBar::setWindowTitle(const QString &title) { if (title.contains("[*]")) { QString content = title.left(title.length() - 3); if (isWindowModified()) { content.append("*"); label->setText(content); } else { label->setText(content); } } else { label->setText(title); } QWidget::setWindowTitle(title); }
bool HtmlEditor::maybeSave() { if (!isWindowModified()) return true; QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("HTML Editor"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (ret == QMessageBox::Save) return fileSave(); else if (ret == QMessageBox::Cancel) return false; return true; }
void MainWindow::New() { if(isWindowModified()) { int s=QMessageBox::warning(this,tr("::NotePad::"),tr("::Document has been modified::""\nDo you wanna save your changes?"), QMessageBox::Cancel|QMessageBox::No|QMessageBox::Cancel); if(s==QMessageBox::Yes) MainWindow::Save(); else if(QMessageBox::No) textedit->clear(); } }
/** query user to save file if modified */ bool spqrMainWindow::checkSave() { if (isWindowModified()) { QMessageBox box(this); box.setIcon(box.Warning); box.setInformativeText(tr("'file '%1' has been modified!").arg(source()->path())); box.setText(tr("Do you want to save your changes?")); box.setStandardButtons(box.Save|box.Discard|box.Cancel); box.setDefaultButton(box.Save); switch (box.exec()) { case box.Save: saveFile(); break; case box.Cancel: return false; } } return true; }
// function that checks if it is ok to continue when the current program // has been modified; return false if the user cancels the request to save // the modified program bool MainWindow::isOkToContinue(void) { if (isWindowModified()) { int answer = QMessageBox::warning(this, tr("IBCP"), tr("The program " "has been modified.\nDo you want to save the changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (answer == QMessageBox::Yes) { return on_actionSave_triggered(); } else if (answer == QMessageBox::Cancel) { return false; } } return true; }
bool chanEditorWidget::okToContinue(){ if (isWindowModified()){ int result = QMessageBox::warning(this, tr("chan Editer"), tr("the document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (result == QMessageBox::Yes) return save(); else if (result == QMessageBox::Cancel) return false; } return true; }
bool MainWindow::maybe_save() { if (isWindowModified()) // if content was modified { QMessageBox::StandardButton ret; // ask, if content should be saved ret = QMessageBox::warning(this, tr("parameterGUI"), tr("The content has been modified.\n" "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard |QMessageBox::Cancel); if (ret == QMessageBox::Save) return save(); else if (ret == QMessageBox::Cancel) return false; }; return true; }
void ItemEditor::closeEvent( QCloseEvent *event ) { if( isWindowModified() ) { switch( QMessageBox::question( this, tr( "Modified" ), tr( "Changes were made to this item, do you wish to save?" ), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save ) ) { case QMessageBox::Save: emit savedItem( m_tibiaItem, m_itemData ); break; case QMessageBox::Discard: event->accept(); return; case QMessageBox::Cancel: event->ignore(); return; default: break; } } event->accept(); }
void UXTEditor::closeEvent( QCloseEvent *e ) { if( isWindowModified() ) { int reply = QMessageBox::question( this, tr( "Table changed" ), tr( "The table has changed. Would you like to save your changes?" ), QMessageBox::Yes, QMessageBox::No ); if( reply == QMessageBox::Yes ) save(); } e->accept(); close(); }
bool MainWindow::okToContinue() { if (isWindowModified()) { int r = QMessageBox::warning( this , tr("Spreadsheet") , tr("The file has been modified。""Do you want to save it?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); if (r == QMessageBox::Yes) { return save(); } else if (r == QMessageBox::Cancel) { return false ; } } return true ; }
void VoxelEditor::closeEvent(QCloseEvent *event) { if (!isWindowModified()) { event->accept(); return; } QMessageBox * msg = new QMessageBox(this); msg->setText("Do you want to save your changes?"); msg->setStandardButtons( QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msg->setDefaultButton(QMessageBox::Save); int ret = msg->exec(); if (ret == QMessageBox::Save) { save(); event->accept(); } else if (ret == QMessageBox::Discard) { event->accept(); } else event->ignore(); }
bool AnnoqtConfEditor::maybeSave() { if ( isWindowModified() ) { int ret = QMessageBox::warning( this, tr( "Application" ), tr( "The configuration has been modified.\n" "Do you want to save your changes?" ), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape ); if ( ret == QMessageBox::Yes ) return slotSave(); else if ( ret == QMessageBox::Cancel ) return false; } return true; }
bool EditorFrame::maybeSave() { if(isWindowModified()){ QString applicationName = QCoreApplication::applicationName(); QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, applicationName, tr("Do you want to save your changes?"), QMessageBox::Save | QMessageBox::No | QMessageBox::Cancel); if (ret == QMessageBox::Save){ return saveIdk(); // TODO might need to call exportIdf } else if (ret == QMessageBox::No){ return true; } else if (ret == QMessageBox::Cancel){ return false; } } return true; }
bool MainWindow::okToContinue() { if(isWindowModified()) { QMessageBox msg; msg.setWindowTitle(tr("QSpreadsheet")); msg.setIcon(QMessageBox::Warning); msg.setText(tr("The document was modified.")); msg.setInformativeText(tr("Do you want to save your changes?")); msg.setStandardButtons(QMessageBox::Cancel | QMessageBox::No | QMessageBox::Yes); msg.setDefaultButton(QMessageBox::Yes); int responde = msg.exec(); if(responde == QMessageBox::Yes) { save(); } else if(responde == QMessageBox::Cancel) { return false; } } return true; }
bool ImageDisplay::okToContinue() { if (isWindowModified()) { int r = QMessageBox::warning(this, tr("MDI Editor"), tr("File %1 has been modified.\n" "Do you want to save your changes?") .arg(strippedName(curFile)), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); if (r == QMessageBox::Yes) { return save(); } else if (r == QMessageBox::Cancel) { return false; } } return true; }
void MainWindow::closeEvent(QCloseEvent *ev) { BEGIN; if (isWindowModified() == true) { raise(); QMessageBox box(tr("Save Changes?"), tr("Do you want to save the changes you made before closing?"), QMessageBox::Question, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape, this, Qt::Sheet); box.setButtonText(QMessageBox::Yes,tr("Save")); box.setButtonText(QMessageBox::No, tr("Don't Save")); switch (box.exec()) { case QMessageBox::Yes: { saveChanges(); setWindowModified(false);// Not really necessary, but stops problems if we get close again. //getWorkbench()->remWindow(this); ev->accept(); break; } case QMessageBox::No: { setWindowModified(false);// Not really necessary, but stops problems if we get close again. //getWorkbench()->remWindow(this); ev->accept(); break; } default: { ev->ignore(); break; } } } }
void MainWindow::openFile(const QString &fileName) { MainWindow *existing = findMainWindow(fileName); if (existing) { existing->show(); existing->raise(); existing->activateWindow(); return; } if (isUntitled && textEdit->document()->isEmpty() && !isWindowModified()) { loadFile(fileName); return; } MainWindow *other = new MainWindow(fileName); if (other->isUntitled) { delete other; return; } other->tile(this); other->show(); }