KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I create a custom QGraphicsItem . And overwrite the boundingRect() and paint() . QRectF myTile::boundingRect() const { return QRectF(xPos*10, yPos*10, 10, 10); } void myTile::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { QRectF rec = boundingRect(); int gvi = value * 255; QColor gv(gvi, gvi, gvi, 255); QBrush brush(gv); painter->fillRect(rec, brush); painter->drawRect(rec); } Then I use addItem() to add a item to a scene. Now I want to get it from the scene by its position. I find the itemAt function. But the problem is I don't know what is the const QTransform & deviceTransform . What should I use for the QTransform ?. Because I didn't implement any transform in the QGraphicsItem . This confuses me.
Tags (comma-separated)
Save Edits
Cancel