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

Unable to display graphics scene in Qt

I am creating a graphics scene in Qt widgets application. The application runs successfully but no graphics scene is displayed. The code that I am using to create scene is: cadviewer::cadviewer(QGraphicsScene *parent)…
Kamalpreet Grewal
  • 822
  • 1
  • 13
  • 28
0
votes
1 answer

Detect when mouse is not in QGraphicsScene

I am having a class inherited from QGraphicsScene. I have a mouseMoveEvent in this class. Based on the mouse move I am sending the co ordinates via signal to the main window. I have multiple GraphicViews in main window. Based on the scene from which…
Sid411
  • 703
  • 2
  • 9
  • 25
0
votes
1 answer

Scaling the QGraphicsScene to fill whole QGraphicsView

I have found a few fixes for this issue, but none of seemed to be sufficient. I have a QGraphicsView displaying a QGraphicsScene. What I want to do is to scale the scene in order to fill the whole view. Also I want it to scale dynamically when the…
Silnik
  • 328
  • 2
  • 4
  • 14
0
votes
0 answers

QGraphicsscene lags with 150+ items

I am not too familiar with the performance of QGraphicsScene and QGraphicsView.. I know that there is a 10 000 chips example which works well and that the QGraphicsScene is optimized for having a large amount of items in it. However, the game I made…
Captain GouLash
  • 1,257
  • 3
  • 20
  • 33
0
votes
1 answer

QGraphicsView::itemAt() method always return zero

I have some custom QGraphicsItems in a QGraphicsView of a QGraphicsScene. I wish to know if there is an Item in the view at given (x,y) coordinates. To test purpose I use the following class as QGraphicsScene: class CustomScene : public…
diegob
  • 35
  • 6
0
votes
0 answers

How to draw sin wave or simple 2DGraph in Qt cpp using QGraphicsView

Can any one help me in drawing simple 2D sin wave plot in Qt using QGraphicsView? after some googling i found some info here Using Qt To Draw the Graph of Sin(x). but i am restricted to use only QGraphicsView without Qpainter.Thanks
vishnu
  • 363
  • 3
  • 20
0
votes
1 answer

Qt: Resizing a png image on Mouse Move Event does not work when resized from left or top side of the rect

I have a png image which is displayed on the graphics scene as a QGraphicsPixmapItem. The image is rectangular in shape. I need to resize the png image every time it is dragged by a mouse move event on any side of the rectangle ie, from…
jeevan_reddy
  • 43
  • 1
  • 10
0
votes
0 answers

How to clear existing content before redrawing QGraphicsItem?

I have a drawing that is built inside a QGraphicsScene with several layers of QGraphicsItem derived objects. I am repositioning the QGraphicsItem objects based on some parameters and have noticed that there are some "ghost" trails left unless I call…
Alan Spark
  • 8,152
  • 8
  • 56
  • 91
0
votes
0 answers

QGraphicsScene Is not performing proper hit detection

I am having an issue where my QGraphicsItem is not alway performing proper hit detection with the mouse. I have subclassed QGrahicsItem and have overridden the shape() method. My shape() method calculates a polygon that surrounds the line. my…
jasonlg3d
  • 484
  • 2
  • 7
  • 18
0
votes
1 answer

Detecting Mouse Event over Multiple Graphics View

I have a class "SceneWindow" which inherits QGraphicsScene. I have a mouse move event which emits the current x and y position of the mouse on the scene. In my main window class I have four graphicsview which I use to display different images. I…
Sid411
  • 703
  • 2
  • 9
  • 25
0
votes
1 answer

Position parentless scene item under another scene item

In my game, I'd like to fire rockets from a rocket launcher. The player holds a rocket launcher as a child item. The rockets must be parentless. I'm trying to position the rocket so that its back lines up with the back of the rocket launcher (the…
Mitch
  • 23,716
  • 9
  • 83
  • 122
0
votes
2 answers

How to make manually calculated orbital paths agree with Qt's ellipse drawing method?

I'm attempting to draw celestial bodies moving around on simplified, perfectly circular orbits. I'm also drawing the projected orbital paths these objects will take. However, the problem is that the actual path the objects take doesn't agree with…
Abu Dhabi
  • 311
  • 4
  • 13
0
votes
1 answer

Selection of widgets in QGraphisScene

I am new to python and have a following problem with Qt; when I run this code and select an item in the table i created, my scene_selection_changed slot is not executed, or at least it seemes so. Can anyone tell me why? class…
Keks
  • 77
  • 7
0
votes
0 answers

Issue saving QGraphicsScene to a PNG file

I have a QGraphicScene object that I can save to a PNG file just fine as long as I haven't made any modifications like a scroll or a zoom on the item. After performing a scroll or a zoom, the saved image becomes small with a lot of transparent…
roundtheworld
  • 2,651
  • 4
  • 32
  • 51
0
votes
1 answer

Should I use QGraphicsScene for an interactive movie?

I have a lot of 2D, time-variant data (aka a movie) that I'd like to visualise inside a Qt interface. The idea is that the results can be viewed as a movie, browsed using a time-slider and then individual data points should be selectable to get more…
Michael Clerx
  • 2,928
  • 2
  • 33
  • 47