The QRect class, part of the Qt framework, defines a rectangle in the plane using integer precision.
Questions tagged [qrect]
26 questions
9
votes
5 answers
Qt Beginner QPainter and QRect
How would I go about drawing a rectangle?
I have tried two different ways;
void MyWidget::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::black);
QRect rect =…

Ash
- 125
- 1
- 1
- 9
4
votes
3 answers
Is there 3D analogy for QRect in qt?
Basically, the tile sums up the question - I am wondering if there is any build in qt class similar to QRect, but for 3D object (to describe a box rather then rectangle)?

Ilya Kobelevskiy
- 5,245
- 4
- 24
- 41
3
votes
1 answer
Turn a rotated QRect into a QPolygon
I am trying to check collisions between a QPolygon and a QRect by turning the QRect into a QPolygon. However, the rectangle might also have a rotation that I have added, so I am wondering how I would turn that QRect into a QPolygon taking into…

Tom Leese
- 19,309
- 12
- 45
- 70
3
votes
1 answer
Making A QPushButton round C++
I'm trying a code to make a QPushButton looking round , this code seems to be working, but after execution , it show me only the half of the ellipse, can anybody help me to figure out why is show only the half of it, its about the m_bouton1 ?
I did…

Madiha Harifi
- 45
- 5
2
votes
1 answer
How to draw a custom shaped element?
I'm currently working in an app which is essentially a pong game. The game features two paddles currently in rectangular format to ease collision detection against the ball(currently square).
I'm using a "QRect" element as paddle since it provides…

Mosufe
- 47
- 7
1
vote
3 answers
Return contents of geometry() as a list in PySide
I'm currently writing an application in PySide, and I want it to save the window dimensions upon exiting. The geometry() method retuns something like PySide.QtCore.QRect(300, 300, 550, 150) but all I want is (300, 300, 550, 150). I could find a…

Sotanaht
- 167
- 2
- 8
1
vote
1 answer
Problem in drawing Rectangle with mouse event in QGraphicScene
I have a class for draw rectangle and it works but when dragging rect and start_point(QPoint) is bigger than end_point, current rect won't show.
this clip show what is my problem!
and the code:
class RectangleScene(QGraphicsScene):
def…

md.119
- 29
- 7
1
vote
1 answer
QGraphicsScene: Artifacts when rendering and saving the scene to a file
I am working with PyQt5 (Version 5.15.7) in PyCharm Community on Windows 11.
I have subclassed the QGraphicsScene and added some attribute and methods I need. I add some QGraphicsItems and QGraphicsItemGroups on the scene and display it in a…

Bartek Kahl
- 31
- 6
1
vote
1 answer
How to move a child window relative to a parent window in PyQt5?
I have the following code, but I want the new window to not set exactly in the center of the main window. I would prefer to move it to the left a little (for example 20 px left, and 20 px up), I have tried moveTo() and moveLeft(), but could not…

Oborzil
- 61
- 6
1
vote
1 answer
QSystemTrayIcon does not return any geometry information
I'm using Ubuntu (17.04) with the Unity desktop. I'm unable to get any geometry information for QSystemTrayIcon:
trayIconMenu = new QMenu(this);
trayIcon = new QSystemTrayIcon(this);
trayIcon->setContextMenu(trayIconMenu);
QPixmap…

Ankur Shah
- 125
- 12
1
vote
0 answers
How to resize a QGraphicsRectItem using the mouse
I am developing a Graphical User Interface (GUI) which allows the user to draw several rectangles and resize them using the mouse pointer.
The code for drawing the rectangles works perfectly. However, when it comes to resizing some unwanted bugs…

Dave_Dev
- 303
- 1
- 12
1
vote
1 answer
QGraphicsRotation to QRectF?
I want to rotate QRectF in PyQT4 by given angle around bottom left corner. I know how to draw a rectangle but I'm stuck on how to rotate it. I tried with rotate(), but it rotates the coordinate system the given angle clockwise.
Is there any easy…

wwarchalowski
- 11
- 2
1
vote
1 answer
Qt - Using a QTransform (or similar), scale inner QRect to/from QGraphics
Some background -
Say you have QGraphicsScene, and only one view, which is a 1-1 scale with the scene.
You have a QRect A, which is represents an external view of the scene, with a pre-defined pixel size.
You have a QRect A1 which is a smaller…

jaunty_jonathan
- 41
- 7
1
vote
1 answer
How to draw an arc with Qt?
Consider the following diagram:
I have information about the center point of both the lines, the angle in between, and the length of both the lines.
The issue is to draw an arc starting at the end of the bottom line and touching the above slanting…

Aquarius_Girl
- 21,790
- 65
- 230
- 411
1
vote
1 answer
Add QRadioButton into QWidget without layout
I am trying to do something that I thought it would be terribly easy : Adding QRadioButton into my QWizardPage without any layout.
The following code that adds QRadioButton is being called when user clicks button Next (signal currentIdChanged calls…

peterphonic
- 951
- 1
- 19
- 38