Annotation Editor question dialog

Change-Id: I4c278abf34bd6c33fe989a5aa80006f1d88f687b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Aleksei German <aleksei.german@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Michael Winkelmann
2021-03-23 13:21:53 +01:00
parent 27c456dd9e
commit b994bb7bd6
3 changed files with 13 additions and 34 deletions

View File

@@ -78,28 +78,15 @@ void AnnotationEditor::removeFullAnnotation()
if (!node.isValid())
return;
QString dialogTitle = tr("Annotation");
if (!node.customId().isNull()) {
dialogTitle = node.customId();
}
QPointer<QMessageBox> deleteDialog = new QMessageBox(Core::ICore::dialogParent());
deleteDialog->setWindowTitle(dialogTitle);
deleteDialog->setText(tr("Delete this annotation?"));
deleteDialog->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
deleteDialog->setDefaultButton(QMessageBox::Yes);
int result = deleteDialog->exec();
if (deleteDialog)
deleteDialog->deleteLater();
if (result == QMessageBox::Yes) {
if (QMessageBox::question(Core::ICore::dialogParent(),
node.customId().isNull() ? tr("Annotation") : node.customId(),
tr("Delete this annotation?"))
== QMessageBox::Yes) {
node.removeCustomId();
node.removeAnnotation();
}
emit customIdChanged();
emit annotationChanged();
}
}
void AnnotationEditor::acceptedClicked()

View File

@@ -49,8 +49,8 @@ AnnotationTabWidget::AnnotationTabWidget(QWidget *parent)
int currentIndex = this->currentIndex();
QString currentTitle = tabText(currentIndex);
if (QMessageBox::question(this,
tr("Global Annotation"),
tr("Do you want to delete this annotation?"))
currentTitle,
tr("Delete this comment?"))
== QMessageBox::Yes) {
removeTab(currentIndex);
if (count() == 0) //lets be sure that tabWidget is never empty

View File

@@ -62,21 +62,13 @@ void GlobalAnnotationEditor::removeFullAnnotation()
return;
QString dialogTitle = tr("Global Annotation");
QMessageBox *deleteDialog = new QMessageBox(Core::ICore::dialogParent());
deleteDialog->setWindowTitle(dialogTitle);
deleteDialog->setText(tr("Delete this annotation?"));
deleteDialog->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
deleteDialog->setDefaultButton(QMessageBox::Yes);
int result = deleteDialog->exec();
if (deleteDialog)
deleteDialog->deleteLater();
if (result == QMessageBox::Yes) {
if (QMessageBox::question(Core::ICore::dialogParent(),
tr("Global Annotation"),
tr("Delete this annotation?"))
== QMessageBox::Yes) {
node.removeGlobalAnnotation();
}
emit annotationChanged();
}
}
void GlobalAnnotationEditor::acceptedClicked()