NoRulez
18th August 2009, 06:53
Hey @all,
for my Project I decided to subclass QGraphicItem and reimplement the paint function.
void MyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
// Draw the pixmap
//painter->drawPixmap(...);
// Draw the item text
painter->drawText(QRectF(-_pixmap.width(), 5, _pixmap.width(), 25), Qt::AlignHCenter, "Demotext");
}
From now, when i move the drawn item, the text aren't repainted / updated. When i move the graphics item fast over the graphics scene, then there are only black fragments from the text, but no "Demotext".
What I'm doing wrong?
Best Regards
NoRulez
for my Project I decided to subclass QGraphicItem and reimplement the paint function.
void MyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
// Draw the pixmap
//painter->drawPixmap(...);
// Draw the item text
painter->drawText(QRectF(-_pixmap.width(), 5, _pixmap.width(), 25), Qt::AlignHCenter, "Demotext");
}
From now, when i move the drawn item, the text aren't repainted / updated. When i move the graphics item fast over the graphics scene, then there are only black fragments from the text, but no "Demotext".
What I'm doing wrong?
Best Regards
NoRulez