Questions tagged [qgraphicsscene]

A QGraphicsScene is a class from the Qt toolkit that provides a surface for managing a large number of 2D graphical items.

The QGraphicsScene class is part of Qt's Graphics View Framework and serves as a container for QGraphicsItems. It is used together with QGraphicsView for visualizing graphical items, such as lines, rectangles, text, or even custom items, on a 2D surface.

A QGraphicsScene also provides functionality which can efficiently determine both the location of items, and which items are visible within an arbitrary area on the scene. It has no visual appearance of its own; it only manages the items. A QGraphicsView widget is needed to visualize the scene.

The official Qt documentation can be found here.

874 questions
1
vote
1 answer

QGraphicsEffect doesn t refresh correctly

Actually i have a QPolygonF who can only move horizontally and when it does, it draws an shadow effect from its initial point to his current. That works great but when i m moving the polygon too fast i got residual effects who doesnt clear correctly…
maitre_c
  • 41
  • 6
1
vote
1 answer

Locking view on QGraphicsView

I'm creating a schematics edit where, simply put, the user can draw lines and rectangles. For this i am using a subclassed QGraphicsView with reimplemented event handlers. Now, when drawing lines, the view shifts in order to put the centerpoint of…
pschulz
  • 1,406
  • 13
  • 18
1
vote
0 answers

Cannot save the contents of a QGraphicsScene in QGraphicsView

I want my application to save the contents of my scene which contains graphics items in it and later be able to retrieve all those items(not as a QPixmap, but as actual individual items). I have tried using Qsettings but get a QVariant error. My…
pr22
  • 179
  • 1
  • 2
  • 9
1
vote
1 answer

Bad rendering of Qrubberband in QGraphicsScene

I have a bad display for q qrubberband thought the wanted coordinates are ok : class Viewer(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.graphicsView = QtWidgets.QGraphicsView() self.hbox =…
Sylvain Page
  • 581
  • 1
  • 7
  • 21
1
vote
0 answers

How to render text of QGraphicsSimpleTextItem from right to left in Qt?

I've an Object that inherits from QGraphicsRectItem and looks like schematic. i want to render the red underlined QGraphicsSimpletextItem inside the rectangle so that it renders from right to left. Is there any function in Qt that can render…
secretgenes
  • 1,291
  • 1
  • 19
  • 39
1
vote
3 answers

Qt animate ellipses along the circle

I am new to the Qt and I am confused how to use the QGraphicsScene. If I add for example 10 ellipses to the scene and animate them along the path, how would I do it? It gets even more complicated, because if I have 10 ellipses drawn along the…
Croolman
  • 1,103
  • 13
  • 40
1
vote
1 answer

QGraphicsItem: how to move it automatically with when QGraphicsScene resizes?

I have a QGraphicsScene and a few QGraphicsItem objects on it. It is a data flow diagram. I want to tie a few objects (input and output ports) to scene borders, and when scene size changes, they should automatically move with the scene bord Cannot…
Felix
  • 3,351
  • 6
  • 40
  • 68
1
vote
3 answers

Qt - QGraphicsScene and QGraphicsView not updating changes?

I am trying something that would seem quite easy, but am struggling a bit with it. I want to be able to draw rectangles in a GUI. What I am doing now is: I create a GUI with Qt Designer, in which I include a QGraphicsView. In my main window I…
Angel
  • 71
  • 1
  • 1
  • 5
1
vote
0 answers

Getting NetworkX edge 'weight' to show in QGraphicsScene

I've been trying to figure out how to get NetworkX to present very nicely into a QGraphicsScene. I need it to be able to show the 'weight' of each edge, which is the amount of times Company1 was in contact with Company2. The scripts that I have…
Daniel
  • 77
  • 3
  • 20
1
vote
1 answer

How do I limit the mouse to a QGraphicsScene in PySide?

Or maybe QGraphicsView? I'm still not understanding mapping. See the comment # I'm not computing x and y correctly. mapTo/From/Global/Scene/??? in myview.py below. The idea is that when you single click on the ring, it toggles the mobility, tying…
1
vote
0 answers

QT draw coordinate system arround QGraphicsView

I would like to draw coordinate system on top and left side of my QGraphicsView. Gimp is a perfect exemple of what i would like to do: Should I implement it by myself using foreground function ? Does there is a dedicated QWidget ?
Erwan Douaille
  • 553
  • 1
  • 10
  • 31
1
vote
0 answers

QGraphiscView/Scene + QWidget as proxy - optimizations

Right, so I have a 100-200 QRectItems with the child being QWidget that has a few QLineedits/checkboxes/etc/etc. I run into issues that if there are a lot of items on the screen and I zoom out the performance drop a lot. Down to "1" fps. When I see…
Dariusz
  • 960
  • 13
  • 36
1
vote
1 answer

PyQt4 on Mac: QGraphicsView with OpenGL is flickering

under Mac OS X I have a problem with QGraphicsView and OpenGL. Sometimes, not everytime, when the QGraphicsView gets updated, then there is a flickering. Without OpenGL it's all fine. But I need OpenGL. Under Win 7 and Ubuntu it's all fine. I'm…
Oli
  • 1,221
  • 2
  • 12
  • 18
1
vote
3 answers

How to refresh QGraphicsView to show changes in the QGraphicsScene's background

I have a custom QGraphicsView and QGraphicsScene. Inside QGraphicsScene I have overriden void drawBackground(QPainter *painter, const QRectF &rect) and based on a boolean flag I want to toggle a grid on and off. I tried calling clear() or calling…
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
1
vote
1 answer

QGraphicsScene, how to place items based on center point

I have a QGraphicsScene, and I have determined where my center point is, but I now need to figure out how to place my items in the scene based on that information. I have 2 pieces of data I need to work with: range and bearing. Range obviously is…
bauervision
  • 847
  • 2
  • 9
  • 25