Questions tagged [qpolygon]

The QPolygon class, part of the Qt framework, provides a vector of points using integer precision.

Documentation can be found here (Qt4) and here (Qt5).

31 questions
5
votes
1 answer

Finding if a QPolygon contains a QPoint - Not giving expected results

I am working on a program in PyQt and creating a widget that displays a grid and a set of polygons on that grid that you are able to move around and click on. When I try to implement the clicking of the polygon, it does not seem to work. Below is…
Jonathan Liu
  • 93
  • 3
  • 10
4
votes
1 answer

Scaling QPolygon on its origin

I'm trying to scale a QPolygonF that is on a QGraphicsScene's QGraphicsView on its origin. However, even after translating the polygon (poly_2) to its origin (using QPolygon.translate() and the center coordinates of the polygon received via…
4
votes
1 answer

How calculate QPolygon area

I'm trying to get the intersection of a blue and green QPolygons, and the % that this makes up of the blue QPolygon (see image below). I've created the polygons as follows: import PyQt5 from PyQt5 import QtWidgets,QtGui,QtCore from PyQt5.QtWidgets…
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
2 answers

PyQt5: Filling in the holes in QPolygon // Increasing the size (height) of a qpolygon

I have the following QPolygon: and I need to increase its size in height to get a following QPolygon: whereas the lower boundary of the qpolygon stays in the same location, that is x1,y1 in the first image, is still x1,y1 in the second image and…
John_Doe
  • 95
  • 1
  • 11
3
votes
1 answer

Get the points of the QPolygonF

I have 3x QPolygonFs drawn on the screen, and I would need to calculate how much of the length of one QPolygon is inside the other. To illustrate, the percentage length of the red or blue polygon that is inside the black polygon: the % of the purple…
3
votes
1 answer

Qt rotated image -> polygon

I have a QImage with center at (x,y) and with size (w,h). I apply a rotation and eventually scaling using QTransform. Now is easy to me to put the new image (rotated/scaled) centered at (x,y). QTransform transform =…
Junior
  • 507
  • 5
  • 19
2
votes
2 answers

Intersection of QPolygons' edges / Getting all the points on Qpolygon's Edge

I have two closed QPolygonFs and I need to find out whether their edges (that is their contours) intersect. As these polygons may be included in one another, looking simply at the intersection of the polygons does not work. PyQt5 has a built-in…
2
votes
1 answer

Scaling a QPolygon or QPolygonF

I need to scale a polygon. write the following Qt Code: QPolygonF qpf=QPolygonF(QPolygon(4,points)); QTransform trans; trans=trans.scale(1.5,1.5); QPolygonF qpf2=trans.map(qpf); path.addPolygon(qpf2); for the points: Qt Code: static const int…
merveotesi
  • 2,145
  • 15
  • 53
  • 84
2
votes
1 answer

Draw arc and override boundingRect(), shape()

I have a class Edge : public QGraphicsItem, which implements drawing arrows from one Node to another (screen below). Now I need to add the ability to draw an arrow on yourself (arc). I cannot draw an arc, override boundingRect() and shape(). Code…
Kto To
  • 434
  • 5
  • 11
1
vote
0 answers

QPolygon transformation

Need to transform polygon vertexes on the fly till origin point 0,0 (instead of center). I have polygon ( 8x64 ) (with predefined vertex): QPolygonF cursor; cursor << QPointF(-4, 32); cursor << QPointF(-4, -32); cursor << QPointF(4, -32); cursor <<…
Dmitry
  • 906
  • 1
  • 13
  • 32
1
vote
1 answer

How draw Polygon from MouseEvents on top of Image in Qlabel

Using Python , PYQT5 I want to draw a Polygon on top a Image, which is in a Qlabel widget. I used a simple Qmainwindow with a label widget generated in QT designer (code is below). I am aware that there are several informations out abaut drawing in…
Erich
  • 41
  • 7
1
vote
0 answers

PyQt4 QPolygonF to QImage

Currently have a program where a user is able to draw their own shape using mouse clicks. It then takes a list of QPointFs (obtainted from user mouse clicks) and creates a QPolygonF. This step is fine and a visible outline of the polygon can be seen…
Alex Zandy
  • 11
  • 1
1
vote
1 answer

Transparency of overlapping polygons in Qt

Is there an easy way to make an overlapping area between two polygons transparent? Preferably built-in functions within the Qt widgets/Qt 2D graphics C++ framework. (not QML) I'm rendering map data extracted from Openstreetmap.org and some advanced…
Erro
  • 143
  • 7
1
vote
1 answer

Qt/C++ Inheritance from QPolygonF as QList item

I have a problem with using QList. T should be an inheritance from QPolygonF. It looks like: class Polygon : public QPolygonF { public: Polygon(){} Polygon &operator=(const Polygon &other); }; When I try to define QList< Polygon>, I get the…
user982040
  • 11
  • 3
1
2 3