Primitive part : Change the cursor shape, according to the current available behavior

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4084 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-08-03 17:26:57 +00:00
parent 3c327009a5
commit 54ac875330
12 changed files with 209 additions and 63 deletions

View File

@@ -36,10 +36,7 @@ CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor, QGr
_color(BlackColor),
_antialiased(false)
{
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
#if QT_VERSION >= 0x040600
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
#endif
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemSendsGeometryChanges);
setAcceptHoverEvents(true);
}
@@ -427,6 +424,14 @@ void CustomElementGraphicPart::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
QGraphicsObject::hoverEnterEvent(event);
}
void CustomElementGraphicPart::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
if (isSelected())
setCursor(Qt::OpenHandCursor);
QGraphicsObject::hoverMoveEvent(event);
}
/**
* @brief CustomElementGraphicPart::hoverLeaveEvent
* Reimplemented from QGraphicsObject.
@@ -436,6 +441,7 @@ void CustomElementGraphicPart::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void CustomElementGraphicPart::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
m_hovered = false;
unsetCursor();
QGraphicsObject::hoverLeaveEvent(event);
}