Suppress scene item context menu if a tool was activated.

A context menu is allowed only if the Arrow tool is active.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-18 11:06:17 +03:00
parent d354b99149
commit 124fd657e3
5 changed files with 16 additions and 0 deletions

View File

@ -1917,6 +1917,7 @@ void MainWindow::CancelTool()
// https://bitbucket.org/dismine/valentina/issues/454/crash-using-crtl-z-while-using-line-tool
undoAction->setEnabled(false);
redoAction->setEnabled(false);
VInteractiveTool::m_suppressContextMenu = true;
return;
case Tool::BasePoint:
case Tool::SinglePoint:
@ -2082,6 +2083,7 @@ void MainWindow::ArrowTool()
currentTool = Tool::Arrow;
emit EnableItemMove(true);
emit ItemsSelection(SelectionType::ByMouseRelease);
VInteractiveTool::m_suppressContextMenu = false;
// Only true for rubber band selection
emit EnableLabelSelection(true);

View File

@ -141,6 +141,11 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, c
SCASSERT(tool != nullptr)
SCASSERT(event != nullptr)
if (m_suppressContextMenu)
{
return;
}
qCDebug(vTool, "Creating tool context menu.");
QMenu menu;
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));

View File

@ -28,6 +28,8 @@
#include "vinteractivetool.h"
bool VInteractiveTool::m_suppressContextMenu = false;
//---------------------------------------------------------------------------------------------------------------------
VInteractiveTool::VInteractiveTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
: VAbstractTool(doc, data, id, parent),

View File

@ -43,6 +43,8 @@ public:
void DialogLinkDestroy();
static bool m_suppressContextMenu;
public slots:
void FullUpdateFromGuiOk(int result);
void FullUpdateFromGuiApply();

View File

@ -1061,6 +1061,11 @@ void VToolSeamAllowance::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
if (m_suppressContextMenu)
{
return;
}
QMenu menu;
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));