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
2
votes
1 answer

move QGraphicsItem continuously in QGraphicsScene and check Collision

about 3 weeks ago I asked for changing a GraphicsItem in a GraphicsScene. It was a line and the solution was: self.setLine(..). Now I try to understand, moving it continuously. So I have a graphicsview gvCanvas and within a scene and initialize…
user3367867
  • 565
  • 1
  • 7
  • 19
2
votes
1 answer

Multiple QGraphicsViews and QGraphicsScenes in a MainWindow

I am looking to develop a Qt application whose main/parent widget is capable of 'holding' one or more "special" widgets. Each special widget displays a separate QGraphicsView and QGraphicsScene. As far as I can see there can only be one central…
Olumide
  • 5,397
  • 10
  • 55
  • 104
2
votes
1 answer

Efficient way to move QGraphicItems inside QGraphicsScene

I am developing a video player using pyqt5. I am using QGraphicsVideoItem inside a scene. On top of this videoitem, I also need to have some polygons that move around the scene on each new frame. They track things in the video. Ideally I wan't to…
Miguel Kulisic
  • 129
  • 2
  • 10
2
votes
1 answer

QGraphicsView fitInView method: resizing problems

I have a custom QGraphicsScene (my class is called MainScene) in my Qt Application. This scene contains some quantity of Rect items, that are placed as if in a grid see picture №1 Also, I can change size of this grid of Rects dynamically picture…
2
votes
1 answer

PyQt 5: QPainter returns false while rendering QGraphicsScene to a QImage

Currently I am working on a program, to display SIP-Trace log files. It is written in Python 3.7 using the PyQt 5(.11.3) module to load and operate a GUI made in QDesigner. As a main feature it parses the SIP-Trace file and displays it as a sequence…
D.Coopmann
  • 23
  • 3
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
2
votes
2 answers

Why is the selection border of a QGraphicsWidget not visible in QGraphicsScene?

I have added a widget to a graphic scene (QGraphicScene) through a QGraphicsProxyWidget. The problem is that when I select the item it's selected, but the selection border is not visible. Here is the code: QDial *dial= new QDial(); // Widget …
Sagar A W
  • 338
  • 1
  • 12
2
votes
1 answer

Remove Dotted Selection around QGraphicsItem

I've search around online for a solution and most of them are in C++ and not complete answers. I was wondering if someone could help me find out how to remove the selection rectangle around a qgraphicsitem as seen in the image below? import…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
2
votes
1 answer

How do I keep drawing on image after window resize in PyQt?

I have written a code to draw a rectangle on an image in a QGraphicsView but if I resize the image, for example full screen, the position of the rectangle becomes misplaced. Is there any way to fix this? I think one possible solution is to align the…
Daniel T.
  • 451
  • 1
  • 8
  • 23
2
votes
2 answers

How to move qwidget on Graphics View?

On a QGraphicsView I set a QGraphicsScene. I add a QDial object through a QGraphicsProxy widget. How to move the QDial object? QDial *dial = new QDial;// dial object dial->setGeometry(event->pos().x(),event->pos().y(),80,80);// placing on…
V. Purbia
  • 57
  • 5
2
votes
1 answer

Hide area of QGraphicsItem that is out of boundary

I have a QGraphicsPixmap item in a QGraphicsScene. The item has flags set to ItemIsMovable, and ItemIsSelectable. How do I ensure that when the item is moved out of a certain boundary - it can be a QGraphicsScene or just a fixed frame size at fixed…
ALH
  • 85
  • 4
  • 14
2
votes
1 answer

QGraphicesItem emit a signal upon hoverEnterEvent

What is the best method/practice for emitting a signal upon entering either a QGraphicsWidget or a QGraphicsItem ? In my MWE I would like to trigger a call to MainWindow.update, from Square.hoverEnterEvent, whenever the user mouse(s) over an item in…
Carel
  • 3,289
  • 2
  • 27
  • 44
2
votes
1 answer

Implementing mouseMoveEvent for qgraphicsObject to follow cursor

I have a Qt application with objects derived from QGraphicsObjcet that need to be movable in a scene. I know that I can use the flags for movement to achieve this. myObject->setFlag(QGraphicsItem::ItemIsMovable); …
Blink
  • 163
  • 1
  • 6
2
votes
1 answer

QGraphicsView RubberBandDrag leaves artifacts

I have a QGraphicsView and a QGraphicsScene set up without any properties changed but view->setDragMode(QGraphicsView::RubberBandDrag); view->setRenderHint(QPainter::Antialiasing, true); When dragging arround for a bit the RubberBandDrag leaves…
iBent
  • 392
  • 1
  • 2
  • 18
2
votes
1 answer

Create closed path with moveable nodes in QGraphicScene

I'm trying to extend the great implementation from this answer so the path will be created from the user's clicks inside the graphic-scene and close the path using a double-click. This works well, but the only issue I couldn't solve yet is the…
avielbl
  • 193
  • 1
  • 7