Disable also deletion tool from keyboard when tool cannot be deleted.

--HG--
branch : develop
This commit is contained in:
dismine 2014-09-26 20:09:20 +03:00
parent 0dc4a33432
commit d950acfc23
4 changed files with 23 additions and 15 deletions

View File

@ -33,6 +33,7 @@
#include "../options.h" #include "../options.h"
#include "vtranslation.h" #include "vtranslation.h"
#include <QSettings> #include <QSettings>
#include "../widgets/vmaingraphicsview.h"
class VApplication;// used in define class VApplication;// used in define
class QUndoStack; class QUndoStack;

View File

@ -36,7 +36,6 @@
#include "../../dialogs/tools/dialogtool.h" #include "../../dialogs/tools/dialogtool.h"
#include "../../widgets/vmaingraphicsscene.h" #include "../../widgets/vmaingraphicsscene.h"
#include "../../xml/vpattern.h" #include "../../xml/vpattern.h"
#include "../../widgets/vmaingraphicsview.h"
/** /**
* @brief The VDrawTool abstract class for all draw tool. * @brief The VDrawTool abstract class for all draw tool.
@ -138,7 +137,6 @@ protected:
} }
if (selectedAction == actionRemove) if (selectedAction == actionRemove)
{ {
qApp->getSceneView()->itemClicked(nullptr);
DeleteTool(); DeleteTool();
} }
} }

View File

@ -168,6 +168,9 @@ void VToolSinglePoint::decrementReferens()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::DeleteTool(bool ask) void VToolSinglePoint::DeleteTool(bool ask)
{ {
if (_referens <= 1)
{
qApp->getSceneView()->itemClicked(nullptr);
if (ask) if (ask)
{ {
if (ConfirmDeletion() == QMessageBox::Cancel) if (ConfirmDeletion() == QMessageBox::Cancel)
@ -179,6 +182,7 @@ void VToolSinglePoint::DeleteTool(bool ask)
DeletePatternPiece *deletePP = new DeletePatternPiece(doc, nameActivDraw); DeletePatternPiece *deletePP = new DeletePatternPiece(doc, nameActivDraw);
connect(deletePP, &DeletePatternPiece::NeedFullParsing, doc, &VPattern::NeedFullParsing); connect(deletePP, &DeletePatternPiece::NeedFullParsing, doc, &VPattern::NeedFullParsing);
qApp->getUndoStack()->push(deletePP); qApp->getUndoStack()->push(deletePP);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@
#include "../core/vapplication.h" #include "../core/vapplication.h"
#include "../geometry/vpointf.h" #include "../geometry/vpointf.h"
#include "../undocommands/savetooloptions.h" #include "../undocommands/savetooloptions.h"
#include "../widgets/vmaingraphicsview.h"
const QString VAbstractTool::AttrType = QStringLiteral("type"); const QString VAbstractTool::AttrType = QStringLiteral("type");
const QString VAbstractTool::AttrMx = QStringLiteral("mx"); const QString VAbstractTool::AttrMx = QStringLiteral("mx");
@ -249,6 +250,9 @@ QPointF VAbstractTool::addVector(const QPointF &p, const QPointF &p1, const QPoi
*/ */
void VAbstractTool::DeleteTool(bool ask) void VAbstractTool::DeleteTool(bool ask)
{ {
if (_referens <= 1)
{
qApp->getSceneView()->itemClicked(nullptr);
if (ask) if (ask)
{ {
if (ConfirmDeletion() == QMessageBox::Cancel) if (ConfirmDeletion() == QMessageBox::Cancel)
@ -259,6 +263,7 @@ void VAbstractTool::DeleteTool(bool ask)
DelTool *delTool = new DelTool(doc, id); DelTool *delTool = new DelTool(doc, id);
connect(delTool, &DelTool::NeedFullParsing, doc, &VPattern::NeedFullParsing); connect(delTool, &DelTool::NeedFullParsing, doc, &VPattern::NeedFullParsing);
qApp->getUndoStack()->push(delTool); qApp->getUndoStack()->push(delTool);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------