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

Multicolor tooltip in Qt

I want to have moveable multicolor tooltip for QGraphicsItems. For example when I click on graphicsItem in scene, tooltip appears, then during dragging mouse tooltip should follow cursor. I can implement movable tooltip with standard QToolTip, but…
IKM2007
  • 716
  • 1
  • 8
  • 31
5
votes
1 answer

Changing multi select bind key in QGraphicsScene

I'm subclassing QGraphicsScene in PyQT and want to use Shift key (modifier) for multi-select items instead of control key. I can do so by subclassing it and making my own mousePressedEvent, but then when I do that, the graphicsItem in the scene…
5
votes
3 answers

Problems with large QImage

I'm pretty new to C++/Qt and I'm trying to create an application with Visual Studio C++ and Qt (4.8.3). The application displays images using a QGraphicsView, I need to change the images at pixel level. The basic code is (simplified): QImage* img =…
David Günzel
  • 73
  • 1
  • 4
5
votes
2 answers

QGraphicsScene is missing a particular item update

I've got an application where you can watch replays for a given 2D game : Basically, a vehicle is moving on a map. The view is centered on vehicle so the map is scrolling as replay is playing, something Micro Machines-like (it's just to give an…
azf
  • 2,179
  • 16
  • 22
4
votes
1 answer

QGraphicsScene scaled weirdly in QGraphicsView

I'm messing around with QGraphicsView and QGraphicsScene to create a Tic Tac Toe clone. I add some QGraphicsLineItems to my scene and override the resizeEvent method of the Widget that contains the view, so that when the window is resized, the view…
Mitch
  • 23,716
  • 9
  • 83
  • 122
4
votes
1 answer

Smooth animations with QGraphicsScene

I hope my question isn't always the same question. I have a QGraphicsScene. Its items are some QGraphicsPixmaps. I move them with a timer that every second does SetX +10. I set +10 cause the window is large 100. With this solution my animations…
Francesco Bonizzi
  • 5,142
  • 6
  • 49
  • 88
4
votes
1 answer

QGraphicsScene::~QGraphicsScene() segmentation fault

Good day! With Qt 4.7.3 an example below crashes at QGraphicsScene::~QGraphicsScene() call: #include #include int main( int argc, char* argv[] ) { // replace this with QObject app; and no problems …
Iakov Minochkin
  • 432
  • 2
  • 10
4
votes
1 answer

Qt: How to implement Panning/Zooming in QGraphicsScene with two finger gestures on laptop trackpad (win/mac)?

I have a Qt 6.2 Application (Windows/Mac) using QGraphicsScene and want to use 2 fingers on the touch pad of my laptop for panning - as many other applications do. Zooming in/out works fine, but using 2 fingers for panning always results in zoom…
RED SOFT ADAIR
  • 12,032
  • 10
  • 54
  • 92
4
votes
3 answers

Fixed transform overlays in QGraphicsView

In a Qt based application I'm developing I'm using a QGraphicsView to display sensor data in a 2D grid. On the side I'd like to show a legend/palette to relate the colours in the grid to values. The user can zoom and pan the sensor data view, but…
datenwolf
  • 159,371
  • 13
  • 185
  • 298
4
votes
1 answer

Add objects asynchronously to QGraphicsScene

I develop an application where a lot of objects need to be added to a QGraphicsScene object in order to represent the diagram of an electric power system. When the grid is large this process takes a while and the main window remains unresponsive.…
Santi Peñate-Vera
  • 1,053
  • 4
  • 33
  • 68
4
votes
1 answer

How to place widget correctly in QGraphicsScene

I'm trying to implement a widget (an improvised toolbox) that will be placed on the right side of the scene. It should looks like this: There's a problem to place it correctly there and keep at the same size and position while moving and scaling…
Artem
  • 563
  • 3
  • 17
4
votes
1 answer

Get Clicked Point Along QPainterPath

How can I get the percentage representing the point clicked along a QPainterPath. For example say I have a line, like the image below, and a user clicks on the QPainterPath, represented by the red dot. I would like to log what percentage the point…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
4
votes
2 answers

How to get Image pixel position loaded in QGraphicsView - Strange MapToScene() behaviour

I am originally loading image in QGraphicsView and using this method for basic zoom out and zoom in functionality. However, I am unable to retrieve actual image pixel position using mapToScene functionality in eventFilter function of…
Anonymous
  • 336
  • 3
  • 23
4
votes
2 answers

Pyside2 how to get mouse position?

I want to get mouse position in my pyside2 application.(not desktop mouse position that QCursor gives) and I tried two way. Bellow is my code. import sys from PySide2 import QtGui, QtWidgets, QtCore class Palette(QtWidgets.QGraphicsScene): def…
4
votes
1 answer

PyQt: Mouse events in QGraphicsView

I would like to write a simple program in Python with PyQt. I have a QGraphicsScene and I would like to do the following: There are 2 options using two RadioButtons: For generating points. This way if someone clicks on the scene an ellipse will…
Dàvid Nagy
  • 159
  • 3
  • 10