diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp index 664f693d559..448aa3c46e5 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp @@ -78,28 +78,15 @@ void AnnotationEditor::removeFullAnnotation() if (!node.isValid()) return; - QString dialogTitle = tr("Annotation"); - if (!node.customId().isNull()) { - dialogTitle = node.customId(); - } - QPointer 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(); } - - emit customIdChanged(); - emit annotationChanged(); } void AnnotationEditor::acceptedClicked() diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationtabwidget.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationtabwidget.cpp index 8a3339acc4f..d0b68b5cfb3 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationtabwidget.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationtabwidget.cpp @@ -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 diff --git a/src/plugins/qmldesigner/components/annotationeditor/globalannotationeditor.cpp b/src/plugins/qmldesigner/components/annotationeditor/globalannotationeditor.cpp index 6adb2f4bf0b..0b04ed5f1c4 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/globalannotationeditor.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/globalannotationeditor.cpp @@ -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(); } - - emit annotationChanged(); } void GlobalAnnotationEditor::acceptedClicked()