Hi all,
I’ve got this QGraphicsProxyWidget which is composed of QFrames and QLabels. A stylesheet defines the appearance of the item. Everything works fine, except for a gray border which appears around some labels whenever the mouse passes over them. I unfortunately don’t have much useful code to show (not sure posting the whole class would be relevant), and can’t send screenshots of the problem from this computer… Not a showstopper for the moment, but a bit annoying and I can’t find any clues about what causes this. Any ideas?
Thx in advance!
EDIT:
Wow! I’ve had no clue about this for the last three months and partially found a solution in about 3 minutes about posting this… Still needs some clarification tough.
I simply overrided the hoverEnterEvent, hoverLeaveEvent and hoverMoveEvent.
void NodeItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
qDebug() << "hoverEnterEvent on NodeItem";
}
void NodeItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
qDebug() << "hoverLeaveEvent on NodeItem";
}
void NodeItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
qDebug() << "hoverMoveEvent on NodeItem";
}
It seems that my QGraphicsProxyWidget ignores setAcceptHoverEvents(false), as debug messages always print.
The problem reappears by adding
QGraphicsProxyWidget::hover{Enter/Leave/Move}Event(event);
in the previous functions.
So a clearer question would be: why is setAcceptHoverEvents(false) ignored? Are empty reimplementations of hover events an acceptable solution?
↧