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

How to print data when a Selectable GraphicsItem is clicked?

I have a JSON file which contains coordinate list and some other information. My JSON structure look like this; "annotations": [ { "type": "Box", "color": "red", …
Sravan JS
  • 41
  • 1
  • 7
-1
votes
1 answer

Qt QGraphicsProxyWidget interaction with QGraphicsScene

I'm trying to make a QSplitter with a QTreeView on the left hand side and on the right hand side, a QGraphicsView. This is super easy and I have this working. Now my goal is to embed widgets in the scene of the QGraphicsView, using the…
Blanky
  • 63
  • 9
-1
votes
1 answer

How can I move a QGraphicsPixmapItem that reachs the right (end) of graphicView to the left (begining) side(like what is happening in the snake game)

I have a QGraphicsView widget which displays a pixmap item. The user can move the item. When the item reachs the right (or the left) end of the graphicView, I would like the item enters from the other side (with the same X and Y coordination (like…
-1
votes
1 answer

How to resize image to fit in graphic view

I have code that displays an image with its name on listWidget. In that case the image won't fit in the graphics view. I tested some of resizing methods. But the images won't resize. How can I resize images to fit in? Please take a look my…
Zin Oo
  • 5
  • 7
-1
votes
2 answers

Co-ordinates for rectItem wrt to other rectItem in qgraphicsScene

In a qgraphicsScene, we have 2 rectItems added. Let's say, the red rect is added first and it's topleft coordinates are (x1, y1) wrt to the qgraphicsscene. Now a second blue rect is added in the scene, which overlaps the red rect. Now how can I get…
-1
votes
1 answer

Error With subclass QGraphicsScene

I'm trying to add ellipses to my Scene in Qt, but i get this error: XXXXXX/mainwindow.cpp:20: error: ‘class mqlabel’ has no member named ‘setScene’ ui->imageLabel->setScene(scene); and this…
Josh Miles
  • 21
  • 1
  • 4
-1
votes
2 answers

How do you implement a snap-to-grid in QGraphicsScene? Mine didn't work

I don't have any code to show because this was over a year ago. I used a timer I think. It did not work very professionally. How would you do it so that it is a smooth operator? I am already able to draw the grid efficiently (ie. in view only). …
MathCrackExchange
  • 595
  • 1
  • 6
  • 25
-1
votes
1 answer

How do you change a QGraphicsScene from another function?

My program has a QGraphicsView called SimulatorGV and it has a QGraphicsScene called Simulation. In the main function I have drawn a few rectangles and ellipses. I want to be able to draw on the same scene in another function too. In essence, how do…
Alarming
  • 137
  • 1
  • 3
  • 14
-1
votes
1 answer

Error : No match for the operand

I trying to implement snapping but getting an error error: no match for 'operator%' (operand types are 'const int' and 'const QSize') const int firstLeftGridLine = realLeft - (realLeft % gridSize); My code to it as…
user3859872
  • 777
  • 2
  • 9
  • 16
-1
votes
1 answer

Qt vector size remains same

I have two classes: point and mainwindow. I declared pointer of point class in mainwindow.h as: point *item; I create an object of point class in mainwindow.cpp: void MainWindow::drawPoint(){ item = new point; …
Kamalpreet Grewal
  • 822
  • 1
  • 13
  • 28
-1
votes
1 answer

Draw the dimensions on QGraphicsItem

I'm drawing a QGraphicsPolygonItem like this: I need to have the dimensions information on the scene, like this: I'm using QGraphicsPolygonItem, QGraphicsScene and QGraphicsView.
Mahmoud Hassan
  • 598
  • 1
  • 3
  • 15
-1
votes
1 answer

converting scene coordinates to graph coordinates

I’m having a scene with (0, 0, 2000, 2000) coordinated as a rectangle. now I just want to plot some points on the scene like graph coordinates like (-x, +y , +x, -y) of the item on the scene . consider of having a Cartesian coordinate points…
Wagmare
  • 1,354
  • 1
  • 24
  • 58
-1
votes
1 answer

Strech QGraphicsView horizontally

How to add horizontal stretch feature to a QGraphicsView? Please help
indira
  • 6,569
  • 18
  • 65
  • 80
-2
votes
2 answers

How to move line with endpoints in PyQt5

I have a graphic scene and 2 classes of a line and endpoint, but there is a problem when i move the endpoints of the line. When i move the line the endpoints will move, but when move the endpoints they just come off the line, even though i make it…
drivereye
  • 33
  • 5
-2
votes
1 answer

Padding issue while drawing points over QGraphicsScene

I have a PyQt application where I have drawn points using QPainter over a QGraphicsScene and made a drag n drop sort of a thing. Now, there is one issue which I'm facing and that is I'm unable to drag those points at the extreme corner and edges of…
Voldemort
  • 175
  • 5
  • 20
1 2 3
58
59