Answer the question
In order to leave comments, you need to log in
How to draw a QGraphicsRectItem with a hole?
Hello, I have a little question: I
have a giant QGraphicsRectItem rectangle stretched to the width of a QGraphicsScene.
How can I subtract another rectangle from it so that a transparent window is obtained in a large one, something like this: It is
possible to draw in parts, something like this:
but this is not optimal - we draw four shapes, and in the first case two, the second of which is subtractive.
But although there is another option to draw such a polynomial to create the feeling of a square with a hole, but then there will be one single figure:
But also not optimal, there will be too many numbers to change the size and position of the hole window.
Is it possible to implement the first option by standard means? (Qt 4.8)
Although the third option is more or less suitable, but if you add a function for comfortable resizing.
Why do I need it?
I am creating a game level editor, the level map is divided into sections isolated from each other, but the game is designed so that all sections are placed in a single coordinate space.
I want to make it so that when the section switch changes, the window-hole moves and covers the section I need, simultaneously with changing the camera position on the coordinate plane. The camera position has already been implemented, but I can’t find a holey square anywhere yet.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question