Hey @all,
i'm trying to get the hover effect working for my QGraphicsLineItem object.
I have subclassed the QGraphicsLineItem class, and in the constructor i wrote:
setAcceptHoverEvents(true);
setAcceptHoverEvents(true);
To copy to clipboard, switch view to plain text mode
I implemented the protected functions like below:
//QGraphicsLineItem::hoverEnterEvent(event);
qDebug() << "void Arrow::hoverEnterEvent(QGraphicsSceneHoverEvent * event)";
pen
().
setColor(QColor(204,
0,
255,
76));
}
qDebug() << "void Arrow::hoverLeaveEvent(QGraphicsSceneHoverEvent * event)";
pen().setColor(myColor);
}
void Arrow::hoverEnterEvent(QGraphicsSceneHoverEvent * event) {
//QGraphicsLineItem::hoverEnterEvent(event);
qDebug() << "void Arrow::hoverEnterEvent(QGraphicsSceneHoverEvent * event)";
pen().setColor(QColor(204, 0, 255, 76));
}
void Arrow::hoverLeaveEvent(QGraphicsSceneHoverEvent * event) {
qDebug() << "void Arrow::hoverLeaveEvent(QGraphicsSceneHoverEvent * event)";
pen().setColor(myColor);
}
To copy to clipboard, switch view to plain text mode
But when i come over the line with my mouse pointer the functions doesn't be executed?
What i'am doing wrong? Can anybody help me.
Regards
NoRUlez
Bookmarks