Hey @all,
for my Project I decided to subclass QGraphicItem and reimplement the paint function.
// Draw the pixmap
//painter->drawPixmap(...);
// Draw the item text
painter
->drawText
(QRectF(-_pixmap.
width(),
5, _pixmap.
width(),
25), Qt
::AlignHCenter,
"Demotext");
}
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");
}
To copy to clipboard, switch view to plain text mode
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
Bookmarks