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

Scrolling QGraphicsView and QGraphicsScene

I have QGraphicsScene instance set to QGraphicsView on the GUI with scrollbars enabled and full view port update. But when I scroll my graphics view I get the items added to qgraphics scene disappeared on some point, though they are added in code…
St Sht
  • 19
  • 3
  • 11
0
votes
1 answer

Animating QWidgets in a QGraphicsScene

So I'm trying to use QPropertyAnimation on a QWidget that has been added to a QGraphicsScene and it's not working. I can't really copy and paste the code as it's intertwined with a somewhat complicated system but the summary is basically this: A…
augzodia
  • 47
  • 5
0
votes
0 answers

Is it possible to have an item that is in one scene moved above another scene in Qt

I am currently learning Qt and I want to have 2 views with 2 seperate scenes. The second view is drawn above first one and only takes a corner of the first view. Is it possible for a custom graphicsitem using the move mouse to be above this second…
new002
  • 21
  • 4
0
votes
1 answer

How to save a graphics image from QGraphicsScene in pyQT

How to render a graphics image from QGraphicsScene in pyQT I have an image in QGraphicsScene, which is created from multiple QGraphicsPixMapItem items. I need to render it out as a single image on disk. Thanks
Program Questions
  • 440
  • 2
  • 6
  • 20
0
votes
1 answer

QGraphicScene Pop Ups for a second then vanishes

I have a all my code inside the constructor of a mainWindow. The problem is that the display only pop ups for a second and than vanishes. Any help will be much appreciated . Following is the code. MainWindow::MainWindow(QWidget *parent)…
jaywalker
  • 1,116
  • 4
  • 26
  • 44
0
votes
1 answer

return custom QGraphicsItem by itemAt() or collidingItems()

I create my own class: class myTile : public QGraphicsItem{} I add these myTile in a QGraphicsScene. Every myTile has a value and a getter for the value. Now I want to get a myTile and read its value. I tried collidingItems() and itemAt(), but the…
lancellx
  • 285
  • 1
  • 5
  • 15
0
votes
1 answer

Signal QGraphicsViewPaintEvent from QPushButton

I have a QPushButton embedded in my QGraphicsScene using a QProxyWidget. When I click the button, I want to change a global game state object and then signal the paint event of the view, to update the entire game. What would be the best way to…
JonMorehouse
  • 1,313
  • 6
  • 14
  • 34
0
votes
1 answer

qt. how to get a graphics item by position (x & y value)

I drew some rectangles on a graphics view in qt creator. Now I want to get a rectangle to change its color and something else by its known position. Is it possible? I don't want to use for loop to check every rectangle's position. Is there an easy…
lancellx
  • 285
  • 1
  • 5
  • 15
0
votes
1 answer

Drawing on QGraphicsScene from a QGraphicsItem derived class

I am working on a RPG game in Qt, using the Graphics View Framework. I have create a class, "Player", which inherits QGraphicsItem. Now, i am trying to make an "attack" animation, so everytime i press the space key, there would be an animation in…
Kanghu
  • 561
  • 1
  • 10
  • 23
0
votes
2 answers

Qt QGraphicsScene and QGraphicsItem events

I've got some QGraphicsObjects which are dependent of the size of the scene they are on. So my graphics object needs to know when two events occur: When it is added to the scene When it's scene is resized The way I do it now is - create 2 signals…
Kolyunya
  • 5,973
  • 7
  • 46
  • 81
0
votes
1 answer

Does QGraphicsScene, or QGraphicsItem, store scene coordinates?

I programmatically move the items in my QGraphicsScene and they end up in the wrong places. They end up at coordinates (2x, 2y), instead of (x, y). Somewhere I am changing the wrong thing. I work both with the scene and with individual items,…
AJO_
  • 315
  • 1
  • 2
  • 10
0
votes
1 answer

adding custom QGraphicsItem to Scene disable ScrollBarAsNeeded and alignment options

Custom item cpp: MapNode::MapNode(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent) { this->x = x; this->y = y; this->w = w; this->h = h; } QRectF MapNode::boundingRect() const { return QRectF(DeafultX, DeafultY,…
GoldenAxe
  • 838
  • 3
  • 9
  • 26
0
votes
1 answer

Best practice to handle multiple documents in QMdiArea?

I need to design and develop a kind of graphics piece of software, which can edit customized files containing graphical elements, etc. I expect the piece of software to contain many documents thanks to the QMdiArea which is actually my central…
Geoffrey R.
  • 1,907
  • 1
  • 19
  • 32
0
votes
1 answer

Smooth line in QGraphicsScene with Qt

I need to draw curves with Qt: The user clicks on QGraphicsScene (via QGraphicsView) and straight lines are drawn between the points clicked on by the user. When the user finishes to draw straight lines (by clicking on the right button), the set of…
QLag
  • 823
  • 1
  • 13
  • 33
0
votes
1 answer

how to set accessible name for a QGraphicsScene?

I'm using QT. I want to set accessible name for a QGraphicsScene because at the mouse click I want to check whether witch graphics scene has been clicked? Thank You
Chanikag
  • 1,419
  • 2
  • 18
  • 31