hmm... looks quite confusing.. I had a look at the QGraphicsItem::sceneEvent() and i found this
{
if (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents) {
if (event
->type
() == QEvent::HoverEnter || event
->type
() == QEvent::HoverLeave || event
->type
() == QEvent::DragEnter || event
->type
() == QEvent::DragLeave) { // Hover enter and hover leave events for children are ignored;
// hover move events are forwarded.
return true;
}
bool QGraphicsItem::sceneEvent(QEvent *event)
{
if (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents) {
if (event->type() == QEvent::HoverEnter || event->type() == QEvent::HoverLeave
|| event->type() == QEvent::DragEnter || event->type() == QEvent::DragLeave) {
// Hover enter and hover leave events for children are ignored;
// hover move events are forwarded.
return true;
}
To copy to clipboard, switch view to plain text mode
May be this is causing some side effect since you are igonoring the hover event. Not sure though. IMHO you should post a simple example. It will make us understand in a better way.
BTW did you try calling
QGraphicsTextItem::setAcceptHoverEvents(false);
To copy to clipboard, switch view to plain text mode
EDIT: If you are doing the above there is no need to reimplement hoverEvent methods as far as i have understood.
Note that QGraphicsTextItem enables hover events while constructing.
Also call setAcceptHoverEvents(true) on your parent item otherwise the handlers are not called.
Its worth to have a look at the documentation of QGraphicsItem::setAcceptsHoverEvents ( )
Bookmarks