Block actions with label depend on restrictions.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-01 07:39:13 +02:00
parent 0a94c5036b
commit 247dc910d5
2 changed files with 40 additions and 14 deletions

View File

@ -299,6 +299,10 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME)
m_eMode = mMove; m_eMode = mMove;
SetOverrideCursor(cursorArrowCloseHand, 1, 1); SetOverrideCursor(cursorArrowCloseHand, 1, 1);
} }
else
{
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
}
setZValue(ACTIVE_Z); setZValue(ACTIVE_Z);
Update(); Update();
@ -311,7 +315,7 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME)
setZValue(ACTIVE_Z); setZValue(ACTIVE_Z);
Update(); Update();
} }
else else // All modifications
{ {
if (m_eMode != mRotate) if (m_eMode != mRotate)
{ {

View File

@ -413,28 +413,47 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
m_dRotation = rotation(); m_dRotation = rotation();
// in rotation mode, do not do any changes here, because user might want to // in rotation mode, do not do any changes here, because user might want to
// rotate the label more. // 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_eMode != mRotate)
if (m_rectResize.contains(pME->pos()) == true)
{ {
m_eMode = mResize; m_eMode = mRotate;
SetOverrideCursor(Qt::SizeFDiagCursor); SetOverrideCursor(cursorArrowCloseHand, 1, 1);
} }
else else
{ {
// if user pressed the button outside the resize square, switch to move mode
m_eMode = mMove;
SetOverrideCursor(cursorArrowCloseHand, 1, 1); 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 { // in rotate mode, if user did just press/release, switch to move mode
if (bShort == true) if (bShort == true)
{ {
m_eMode = mMove; if (m_moveType != OnlyRotatable)
{
m_eMode = mMove;
}
UpdateBox(); UpdateBox();
} }
else else