Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

ItemClipsToShape doesn't work

$
0
0
Hi, I have a custom QGraphicsItem class that paints some complexes figures into scene. I have re-implemented boudingRect() member in order to make suitable “click and drag” on these kind of items. But a QRectF is not enough accurate for the precision that I need in clicks. In my QGraphicsItem custom class I have the following sentences: this->setFlag(QGraphicsItem::ItemClipsToShape, true); this->setFlag(QGraphicsItem::ItemIsMovable, true); As I understand, ItemClipsToShape flag should replace the call “boundingRect()” to check if item has been clicked, for “shape” (that returns a QPaintPath) with the shape where I want to detect the click. Shape has been implemented correctly, to check it, I draw it and It’s properly drawn in scene:     QPainterPath path = shape();     painter->drawPath(path); //Properly drawn. The problem: it seems like Qt is still calling “boundingRect()” to get the area that I want to use to check if item is clicked, even with the flag set. Any suggestions?

Viewing all articles
Browse latest Browse all 13965

Trending Articles