From 247dc910d5782dc252f918d3c3fbc4c0c673f3b7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Mar 2017 07:39:13 +0200 Subject: [PATCH] Block actions with label depend on restrictions. --HG-- branch : feature --- src/libs/vwidgets/vgrainlineitem.cpp | 6 +++- src/libs/vwidgets/vtextgraphicsitem.cpp | 48 ++++++++++++++++++------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index ec76be497..124093cd3 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -299,6 +299,10 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); } + else + { + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } setZValue(ACTIVE_Z); Update(); @@ -311,7 +315,7 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) setZValue(ACTIVE_Z); Update(); } - else + else // All modifications { if (m_eMode != mRotate) { diff --git a/src/libs/vwidgets/vtextgraphicsitem.cpp b/src/libs/vwidgets/vtextgraphicsitem.cpp index 463b7506f..150562ddf 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.cpp +++ b/src/libs/vwidgets/vtextgraphicsitem.cpp @@ -413,28 +413,47 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME) m_dRotation = rotation(); // in rotation mode, do not do any changes here, because user might want to // rotate the label more. - if (m_eMode != mRotate) + + if (m_moveType == OnlyRotatable) { - // if user pressed the button inside the resize square, switch to resize mode - if (m_rectResize.contains(pME->pos()) == true) + if (m_eMode != mRotate) { - m_eMode = mResize; - SetOverrideCursor(Qt::SizeFDiagCursor); + m_eMode = mRotate; + SetOverrideCursor(cursorArrowCloseHand, 1, 1); } else { - // if user pressed the button outside the resize square, switch to move mode - m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); } + + setZValue(ACTIVE_Z); + Update(); } - else + else // All modifications { - SetOverrideCursor(cursorArrowCloseHand, 1, 1); + if (m_eMode != mRotate) + { + // if user pressed the button inside the resize square, switch to resize mode + if (m_rectResize.contains(pME->pos()) == true) + { + m_eMode = mResize; + SetOverrideCursor(Qt::SizeFDiagCursor); + } + else + { + // if user pressed the button outside the resize square, switch to move mode + m_eMode = mMove; + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } + } + else + { + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } + // raise the label and redraw it + setZValue(ACTIVE_Z); + UpdateBox(); } - // raise the label and redraw it - setZValue(ACTIVE_Z); - UpdateBox(); } } @@ -553,7 +572,10 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) { // in rotate mode, if user did just press/release, switch to move mode if (bShort == true) { - m_eMode = mMove; + if (m_moveType != OnlyRotatable) + { + m_eMode = mMove; + } UpdateBox(); } else