Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Make QGraphicsItem interact with an image

2 posters

Go down  Message [Page 1 of 1]

1Make QGraphicsItem interact with an image Empty Make QGraphicsItem interact with an image Sun Mar 06, 2022 11:37 pm

feri



I ask you for help because I could not find a way to select the red part of the image attached in a QGraphicsItem so that it can interact with other QGraphicsItems that I create.
The image will look like this:

Make QGraphicsItem interact with an image Image10

I wish I could find the intersection of the items I insert with the red part of the image.

QPainterPath intersectedPath = item1->shape()->intersected(item_red->shape());

Thanks for your help.
Greetings

arcachofo

arcachofo

Not sure how are those QGraphicsItems implemented.
Not sure but I think that by default shape() = boundingRect(), so it's a rectangle.
If you want to to create another shapes you should override QGraphicsItem::shape().
As an example have a look at Servo::shape() or Buffer::shape().

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum