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
0
votes
3 answers

Add an Image to certain position in QGraphicsScene

I am developing a program to allow users to select a file and add it to QGraphicsView. Everything esle works fine except item-positioning. All images are displayed in the same position. Source code is as below //user action to add an image void…
Dustin Sun
  • 5,292
  • 9
  • 49
  • 87
0
votes
1 answer

Qt: displaying a QGraphicsItem for 4 secs

I'm writing a simple game, and I have a rect, that I want to display for a few secs, and then disappear. Could someone help me, how to do this? I found, that with QThread::sleep() I can make my program wait, but I also have read, that I shouldn't…
ameline
  • 13
  • 4
0
votes
1 answer

How to save QGraphicsScene items to a .dxf file

I'm going to write an app in Qt that uses Qt Graphics View Framework. I have a QGraphicsScene with some simple texts in it. I'm going to export the scene to be used in Corel Draw. I think the best option is to save items in a .dxf file. Is there…
s4eed
  • 7,173
  • 9
  • 67
  • 104
0
votes
1 answer

Phonon doesn't work in QGraphicsScene

The following code QApplication a(argc, argv); Phonon::MediaObject *media = new Phonon::MediaObject(); Phonon::VideoWidget *video = new Phonon::VideoWidget(NULL); video->setGeometry(0, 0, 200, 200); Phonon::createPath(media,…
0
votes
0 answers

How to use a complex OpenGL as background in QGraphicsScene?

I'm trying to create a display with a complex OpenGL image and some spinboxes on the image. Using http://doc.qt.digia.com/qq/qq26-openglcanvas.html I'm able to have a two layers object (inheriting from QGraphicsScene) with a simple OpenGL image as…
user1235648
0
votes
1 answer

Qt wait for user to select items in QGraphicsScene

So I have 2 QGraphicsScenes with QGraphicsViews in my ui. In those QGraphicScenes are QGraphicsItems, now I want to make my program wait to let the user select one QGraphicsItem om each Scene, but how do I do this? I've tried things…
Cédric Vandelaer
  • 153
  • 1
  • 5
  • 13
0
votes
0 answers

Containing a Rectangle inside another Rectangle

I didn't find a previous question that seemed to suit what I am asking, but I may not be asking the right thing either. I have two rectangles, one larger and one smaller. The smaller one can be moved and resized, but I need it contained inside the…
ooklah
  • 491
  • 1
  • 5
  • 16
0
votes
1 answer

Force A QWidget to End Event Propagation

I attached a QLineEdit to a subclass of QGraphicsScene. I noticed that the QGraphicsScene is also getting any mouse event (such as mouse press, mouse release, mouse move, etc) in addiction to the QLineEdit I attached. Is there any way to prevent the…
K. Barresi
  • 1,275
  • 1
  • 21
  • 46
0
votes
1 answer

Placing a QWebView Over an Existing QGraphicsView

I'm trying to place a QWebView on top of an existing window that is just a QGraphicsView containing a single QGraphicsScene. Is there any way to do this without creating a new window? My goal is just to overlay most of the screen and dim out the…
K. Barresi
  • 1,275
  • 1
  • 21
  • 46
0
votes
2 answers

Text position scaling

I'm now using QGraphicsView and QGraphicsScene for showing some charts. Depending on values of that charts (they are histograms) I change the scale. I also draw some text (they are derived from QGraphicsItem) for showing their values like this But…
nabroyan
  • 3,225
  • 6
  • 37
  • 56
0
votes
1 answer

QGraphicsView to pdf

I have a big scene successfully displayed in my window with the help of QGraphicsView/QGraphicsScene with scroll bars for navigation. Everything works fine. Now I would like now to render part of the scene in a pdf. The region to be render in the…
Ote
  • 301
  • 1
  • 5
  • 16
0
votes
1 answer

Access other item contents within a QGraphicsScene

I have a dialog.cpp file, it is within here I created my QGraphicsScene which uses the QGraphicsView. I created two classes that inherit QGraphicsPixmapItem, "Vehicle" and "Junction". Both of these objects are added to the same QGraphicsScene in my…
eddie-ryan
  • 285
  • 1
  • 5
  • 19
0
votes
0 answers

QGraphicsView/QGraphicsScene rendering glitches

Let’s say I add an image to a scene and a line such that one of its endpoint is precisely on one of the corners of a pixel. When I zoom in or out the view I see that the endpoint of the line shifts relative to the background image.. As I change the…
borisz
  • 1
0
votes
1 answer

PySide: Resizable scene in QGraphicsView

I'm trying to find a way to mark the border of a QGraphicsScene, and make it resizable inside a QGraphicsView, to create something similar to Microsoft Paint. In other words, my current QGraphicsView looks like this: But my image is only this big,…
midrare
  • 2,371
  • 28
  • 48
0
votes
1 answer

How to get the color of XY point on QGraphicsScene?

This seems trivial, but can't find a solution. I need to read a color of certain x,y point on QGraphicsScene. Something like graphScen->colorAt(x,y);
Ko Cour
  • 929
  • 2
  • 18
  • 29