From 16cf055b4cd3e7ee757afbda16202b7c1e5dcdf0 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 5 Feb 2014 17:32:50 +0200 Subject: [PATCH] Fixed issue #62. --HG-- branch : develop --- src/mainwindow.cpp | 2 +- src/tools/vabstracttool.cpp | 10 ++++++++++ src/tools/vabstracttool.h | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 00cda83ae..2c64bc70d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -612,7 +612,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { if (changeInFile == true) { - QMessageBox msgBox; + QMessageBox msgBox(this); msgBox.setText(tr("The pattern has been modified.")); msgBox.setInformativeText(tr("Do you want to save your changes?")); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index 8196111ee..c88853368 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -210,6 +210,16 @@ void VAbstractTool::DeleteTool(QGraphicsItem *tool) { if (_referens <= 1) { + QMessageBox msgBox; + msgBox.setText(tr("Confirm the deletion.")); + msgBox.setInformativeText(tr("Do you really want delete?")); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setIcon(QMessageBox::Question); + if (msgBox.exec() == QMessageBox::Cancel) + { + return; + } //remove from xml file QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 7141a5323..c18f77f92 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -31,6 +31,7 @@ #include "vdatatool.h" #include "../xml/vdomdocument.h" +#include /** * @brief The VAbstractTool abstract class for all tools. @@ -47,7 +48,7 @@ public: * @param parent parent object. */ VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); - virtual ~VAbstractTool() {} + virtual ~VAbstractTool(){} /** * @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view. * @param sc scene.