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 "vtranslation.h"
#include <QSettings>
#include "../widgets/vmaingraphicsview.h"
class VApplication;// used in define
class QUndoStack;

View File

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

View File

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

View File

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