Questions tagged [qgraphicsrectitem]

19 questions
3
votes
1 answer

How to scale text to fit inside a bounding box with QPainter?

I need to draw a label onto a box. Ideally I'd scale the label with the size of the box, but I'm not sure if there is any built in functionality for this kind of scaling. At present I'm scaling the object to the height of the bounding box, but I'm…
Mikhail
  • 7,749
  • 11
  • 62
  • 136
3
votes
1 answer

How to resize QWidget added in QGraphicScene through QGraphicsProxy?

I have added a widget to a graphic scene (QGraphicScene) through a QGraphicsProxyWidget. To move and select the widget added QGraphicsRectItem handle. To resize widget added QSizegrip to widget. But when i resize widget more than the QGraphicsRect…
Sagar A W
  • 338
  • 1
  • 12
2
votes
1 answer

PyQt issue with resizing and repainting of QGraphicsRectItem

I'm trying to create a resizable QGraphicsRectItem with an option to choose different draw styles. If I create a simple rect with a resize feature only, then it works as expected: class Rectangle(QtWidgets.QGraphicsRectItem): def __init__(self,…
Artem
  • 563
  • 3
  • 17
2
votes
1 answer

Why I can't enlarge a widget added to QGraphicScene by QSizeGrip?

I have added a widget to a graphic scene QGraphicScene through a QGraphicsProxyWidget. To move it I have set QGraphicsRectitem as its parent. The widget is resized with the use of a sizegrip. The first time I create an object I can enlarge it upto…
Sagar A W
  • 338
  • 1
  • 12
1
vote
1 answer

How can I subclass QGraphicsRectItem and QGraphicsEllipseItem in one class?

I'm using Pyside2 and have a UI that uses QGraphicsView and a QGraphicsScene. Right now I have two separate classes that subclass QGraphicsEllipseItem and QGraphicsRectItem like this: class MyRectButton(QGraphicsRectItem): def…
1
vote
1 answer

QGraphicsItem not staying in place after being moved

I'm currently creating an application that uses QGraphicsView and allows the user to move QGraphicsItems around, so they can create diagram-like structures. I need the items to change color when clicked but change back to their original color when…
1
vote
1 answer

QGraphicsItem interactive resize for rectangles

I am making an application where the user can draw rectangles, circles and polygons on a scene. These items can then be selected, deleted, moved around, etc. The code below shows what I have done to achieve this: class…
Athylus
  • 193
  • 1
  • 1
  • 10
1
vote
1 answer

Adding horizontal slider to QTableWidget

I am trying to design something like a timeline view for my video player. I decided to use QTableWidget as the timeline since it suits my purpose. My widget looks like this: I want the green line to run through the widget when i click on play. Here…
MarKS
  • 494
  • 6
  • 22
1
vote
1 answer

geometry of QGraphicsRectItem

I have a qgraphicsRectItem drawn on a qgraphicsScene. With mouse events, it's being moved over the scene, resized and repositioned, ie, select the item, mousePress and mouseMove. How can I get the geometry of that qgraphicsRectItem boundingRect, pos…
Sayan Bera
  • 135
  • 2
  • 16
1
vote
1 answer

how to fill a QGraphicsRectItem with certain color?

I have been trying to find a way to fill an instance of QGraphicsRectItem with any color, let's say red color, but I failed to find a clear way as of how to accomplish this naive task, It would be great if you could provide some hints, links,…
mansanto
  • 360
  • 4
  • 16
0
votes
0 answers

color individual points separately in QScatterSeries of Qt Charts

am trying to color each points of QScatterSeries in Qt Chart separately when we click on each points. //adding scatter series for(int i = 0; i < CLUSTERSERIESCOUNT; ++i)//3 times { m_clusterseries[i] = new QScatterSeries(); …
Sayan Bera
  • 135
  • 2
  • 16
0
votes
1 answer

PyQt5: Resizable `QGraphicsRectItem`: How to properly update its position (in scene coordinate)

I create a resizable QGraphicsRectItem, I am able to resize it just fine, but I am not able to update the position of the new resized item in its scene import typing import sys from PyQt5.QtGui import QPen, QBrush, QColor, QResizeEvent from…
0
votes
0 answers

How setTransformOriginPoint of QGraphicsRectItem for rotation and offset

I didn't find the answer so I would like to ask how to set origin point for rotation. For example I set the Origin Point for rotation to [200,200] and I would like to keep the Origin Point for rotation before and after the offset occurs. I tried…
Pr.Syn
  • 99
  • 1
  • 7
0
votes
1 answer

Rotated QGraphicsRectItem moves randomly when dragged using mouse

I have a movable QGraphicsRectItem which is rotated to 90 degrees and set to a scene. When I drag the item, it moves randomly and eventually disappear. However, when I set the rotation to 0, the item moves flawlessly. Here is my minimal reproducible…
jon_bovi
  • 71
  • 3
  • 11
0
votes
1 answer

How to remove a QGraphicsRectItem from a QVector?

I have a QVector filled with QGraphicsRectItem elements (little rectangles) and I need to remove one single rectangle when a user clicks on it. I tried to use removeItem(vec.begin() + i) and delete vec.begin() + i functions, removeItem(vec[i]) and…
Julia
  • 11
  • 1
1
2