--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-06 18:47:44 +02:00
commit 0e60b20ace
2 changed files with 43 additions and 0 deletions

View File

@ -113,6 +113,7 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32
qApp->getUndoStack()->endMacro();
}
}
setAcceptHoverEvents(true);
}
//---------------------------------------------------------------------------------------------------------------------
@ -391,6 +392,20 @@ void VToolDetail::keyReleaseEvent(QKeyEvent *event)
QGraphicsItem::keyReleaseEvent ( event );
}
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (flags() & QGraphicsItem::ItemIsMovable)
{
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
event->accept();
}
}
QGraphicsPathItem::mousePressEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
@ -401,10 +416,34 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (event->button() == Qt::LeftButton)
{
emit ChoosedTool(id, SceneObject::Detail);
//Disable cursor-arrow-closehand
RestoreOverrideCursor(cursorArrowCloseHand);
}
QGraphicsItem::mouseReleaseEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
SetOverrideCursor(cursorArrowOpenHand, 1, 1);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
SetOverrideCursor(cursorArrowOpenHand, 1, 1);
}
////---------------------------------------------------------------------------------------------------------------------
void VToolDetail::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
//Disable cursor-arrow-openhand
RestoreOverrideCursor(cursorArrowOpenHand);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.

View File

@ -93,7 +93,11 @@ protected:
virtual void AddToFile () Q_DECL_OVERRIDE;
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverMoveEvent( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;