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
2 answers

Draw a tree with Qt

I need to draw a tree with Qt, I was thinking using QGraphicsScene and QGraphicsItem for the nodes. But as I want the nodes to be movable, so how do it the best way for the lines between the node ? Any suggestions ? Thx.
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
1
vote
1 answer

Qt text editor on picture

I haven't found an exact question on this. I have a picture, it could be blank for the sake of the example, or contain something that I want to add a fancy caption to. I want to add text editing means (akin to Photoshop) on top of the picture. I'm…
wolf9000
  • 141
  • 1
  • 9
1
vote
1 answer

pyqt get image position

I have an QGraphicsscene on which there is a picture QPixmap into QGraphicsView. I resolved to QPixmap QGraphicsItem.ItemIsMovable. And I want to get the position of the picture when it move. How do I can do this?
John Smith
  • 11
  • 1
  • 4
1
vote
1 answer

How to draw Qt widgets using Horde3d and OpenGL?

What I want is a Qt Application that uses Horde3D to display a 3d scene and draw QWidgets on top of the 3D scene using Horde3D(or OpenGL). Basically I want to add UI for my 3D scene. And this UI should be drawn using OpenGL. I've successfully…
Dmitriy
  • 5,357
  • 8
  • 45
  • 57
1
vote
3 answers

Drawing Shapes within a QGraphicsItem (parent) with positions relative to the parent

I have my own object implementing a QGraphicsItem - it is essentially just a square with a border. I am attempting to draw shapes within that item, using it as the parent. The issue is that the coordinates I am using for the shapes within the parent…
dajaffe
  • 855
  • 13
  • 34
1
vote
1 answer

For QGraphicsScene using setZValue on a QGraphicsItem causes major slowdown

I'm using Qt (Mac, version 4.7) to rendering a rather large scene (map data from Open Street Maps) with QGraphicsView and QGraphicsScene. Everything works great until I try to set the Z value for the items in the scene. I've tried two separate…
Abe Schneider
  • 977
  • 1
  • 11
  • 23
1
vote
1 answer

Displaying an image with QGraphics Scene

Having an issue with displaying a loaded image in a QGraphicsScene. CTextBox::CTextBox(QWidget* parent /* = NULL */) { QPixmap image; image.load("basketball.png"); grid = new QGridLayout(); grid->setSpacing(1); textBrowser = new…
Bushes
  • 1,010
  • 1
  • 18
  • 37
1
vote
1 answer

QGrahicsItem and their children

I have now tried for hours to make sense of how QGraphicsItem behaves with respect to children. I create a new QGraphicsItem B (actually an own subclass of it), and then add it to another QGraphicsItem A as child by invoking the setParentItem method…
André
  • 61
  • 1
  • 4
1
vote
1 answer

How to attach multiple lines to a single QGraphicsPixmapItem?

Currently, I'm joining two QGraphicsPixmapItem with a line and able to move them around, but when when I add a third QGraphicsPixmapItem and try to connect it to one of them, it breaks the previous joined line. Here is my current code : #include…
Toloka
  • 23
  • 5
1
vote
1 answer

How to do lower() and raise() for QGraphicsItem in Qt?

I wanted to changed z-order of graphicsitems in my graphicsscene. I have used QGraphicsWebView as graphicsitem. How can i achieve it ?
Ashish
  • 8,441
  • 12
  • 55
  • 92
1
vote
0 answers

QGraphicsScene "itemAt()" not detecting QGraphicsEllipsesItem

I've got a Qt application implemented consisting of a main window with a custom QWidget called CanvasWidget that has a QGraphicsScene and view in which items are drawn. The objects are visible and drawn correctly, however, when testing for…
hopoffZ
  • 11
  • 3
1
vote
1 answer

How to intercept QGraphicsSceneMoveEvent, change event position and call super().mouseMoveEvent()?

I'm happy of QGraphicsItem.ItemIsMovable to move a QGraphicsRectItem() with the mouse. If the Control Key is pressed down, I would like it to move only vertically = keep mouse the position x() a fixed value. To keep it simple, below code doesn't…
jljPatch
  • 23
  • 6
1
vote
1 answer

PyQt6: How can I fetch position of mouse pointer from QGraphicsScene and use the variables in the other class?

I'm new to pyqt6 and even to python. As the title indicates, I got stuck with handling mouse position variables. I was expecting to show coodinates of mouse pointer in the QLabel correspond to the mouse movement. I was able to fetch coordinates…
nonoY
  • 13
  • 5
1
vote
0 answers

Getting wrong name in mouse hover property in Qt

I am having QGraphicsScene which contains many digital gates ( AND,OR,NOR etc ) which are made up of Arc, Polyline, Circle, Straight line etc. I am implementing a feature like, when I hover mouse over input of Gates, it's name should be seen on tool…
tushar
  • 313
  • 4
  • 10
1
vote
1 answer

How to easily recognize searched item in a dense QGraphicsScene?

I have a QGraphicsScene with many QGraphicsItem like circle, rectangle, polylines, arc etc. Every QGraphicsItem has a name. And I have a Search feature which highlights searched items using that name. When scene contains fewer items, highlighted…
tushar
  • 313
  • 4
  • 10