NoRulez
7th May 2008, 19:02
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);
I implemented the protected functions like below:
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);
}
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
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);
I implemented the protected functions like below:
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);
}
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