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
1
vote
1 answer

How to know if a point is on the perimeter of a QPolygon (PyQt4)

Is there any function in PyQt4 to help me decide if a point is on the perimeter of a QPolygon? For example: from PyQt4 import QtGui from PyQt4.QtCore import Qt, QPoint as QP polygon = QtGui.QPolygon([QP(0, 1), QP(3,7), QP(4, 6), QP(4,3), QP(2,1),…
HuongOrchid
  • 332
  • 3
  • 15
1
vote
2 answers

Scaling an already drawn QPolygonF in drawing

So, I draw a QPolygonF in an area which I define. The area inherits from QGraphicsView. What I want to be able to do is let user move around the control points of QPolygonF and alter the polygon even after it has been created. I couldn't really…
navderm
  • 799
  • 2
  • 11
  • 33
0
votes
1 answer

How can I rotate an ellipse in a QPainterPath in Qt?

i know i can draw an ellipse in Qt with QPainter. But i want to rotate the Ellipse inside a QPainterpath. Does anybody know how i can do that? The goal is to subtract two ellipses. I know that i can subtract two ellipses by subtracting two…
0
votes
1 answer

QGraphicsPolygonItem - How to change Points coordinates

I'm working on QT since last week and I'm new to graphics management. I have a polygon that represents 4 pressure graphically: How can I refresh the polygon with the new pos position? double deltaPos_A = vshp->cpu_v.paramCpuToVisu.liftData[0].pos -…
0
votes
1 answer

Texturing a QPolygon element

I'm currently working on a hex-based 2D board game using Python. I'm not using PyGame, I'm doing this the harder way in order to practise. The graphics are currently created using PyQt5. The hexagon tiles are created using QPolygonF and…
Samittaja
  • 3
  • 2
0
votes
1 answer

PyQt5: Centre line of a QPolygonF

I'm trying to get the centre line of a QPolygonF object, meaning the line that is in the middle of min and max X coordinate, for every single y coordinate from min to max. The desired output would be a single centre line, yet for some reason the…
0
votes
0 answers

C++ QT Altering Polygon Points

I'm trying to allow the user to be able to alter the points of a shape. If I create one Rectangle I'm able to alter each point however, the second I add another Rectangle It only alters the points of the first shape and moves the first shape over…
Jooshhy
  • 1
  • 1
0
votes
0 answers

A bad spatial partitioning using quadtree

I am working on a path planning algorithm for a mobile robot. I am trying to implement a quadtree algorithm to model the spatial information. Each node contains a boolean variable that is true if the quad intersects with the path. For a path like…
billyDev
  • 1
  • 1
0
votes
1 answer

Turn QPolygon into a QPushbutton

I would like to paint a QPolygon on my Window and be able to use it as a QPushbutton. Is there any way to do this? (most preferably without using QMousePressEvent to check the position of the mouse with the position of the polygon) After the advice…
0
votes
0 answers

how can I get if a QPolygon is simple?

I am coding a tool that enables to draw polygons. I want them to be simple polygons and forbid drawing complex polygons. I have tried ToSubpathPolygons() I have the list of QPoints that form the polygon. I am coding in c++ + Qt. I think I could try…
P.Perez
  • 9
  • 4
0
votes
1 answer

Qt QGraphicsItem drawing a polygon within the boundingRect() of separate class?

I've created a GraphicsItem in a new class and have painted a polygon, however, instead of it being drawn inside the boundingRect() for the class it is drawing on the main GraphicsView at coordinates I hoped it would be drawn inside the…
Alarming
  • 137
  • 1
  • 3
  • 14
0
votes
0 answers

How to draw Convex Rectangle in combination with ellipsoids by using Qt4.8 (C++)? (top view of a boat)

I'm currently trying to draw the top view of a boat by using Qt 4.8 (C++). I want to implement a QWidget in which a boat moves around. Therefore I need to draw the top view of a boat, it should look similiar to this (only need the outer…
0
votes
2 answers

how to get the end point of a translated QPolygon

I'm trying to draw an arrow so I just referred to the example code where we can draw arrows: http://doc.qt.io/qt-5/qtwidgets-graphicsview-elasticnodes-edge-cpp.html I decided to draw using the same formula and tried…
Wagmare
  • 1,354
  • 1
  • 24
  • 58
0
votes
0 answers

Why doesn't my Qt Creator know QPolygon?

I have the following simple code. I just start writing my application and get stuck on this problem: Qt Creator tells me, that QPolygon file or directory doesn't exists. I checked it with QT Documentation and it says, ther is. #include…
Kousalik
  • 3,111
  • 3
  • 24
  • 46
-1
votes
2 answers

Qt struct of QPolygon

I have this structure: typedef struct { QPolygon polygon; QRect position; } form; I try to initialize forms like below but I got segmentation fault error: int n = 10 forms = (form*) malloc(sizeof(form) * n); while (n>0) { …
Junior
  • 507
  • 5
  • 19