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

How to scrolling QGraphicsScene in QGraphicsView by middle mouse?

I use pyqt4.8 and python2.7 I create QGraphicsView and insert QGraphicsScene. Scene bigger than View and need to scroll. View have vertical and horizontal scrolls, but i want to scroll by mouse middle button. I create mouse event functions but…
Massimo
  • 836
  • 3
  • 17
  • 38
3
votes
1 answer

pyqt. How do you know the type of object in QGraphicsScene?

i use pyqt4.8 + python2.7 in QGraphicsScene i add different objects like QGraphicsEllipseItem and QGraphicsProxyWidget (with QPushButton). To work with different types of objects have to call different functions. such as changing the size of the…
Massimo
  • 836
  • 3
  • 17
  • 38
3
votes
1 answer

Deleting and freeing QGraphicsItem class derived objects

I have derived from the QGraphicsItem class and drawing some custom shapes. These multiple shapes are then added to a QGraphicsScene. class StairCurve : public QObject, public CurveShape, public QGraphicsItem class BezierCurve: public QObject,…
Amit Tomar
  • 4,800
  • 6
  • 50
  • 83
3
votes
1 answer

Save/Load items from a QGraphicsScene

I want to save all items in a QGraphicsScene to a file. When I load the file, I should be able to use them as QGraphicsItems(as before). I keep my items in a QList like QList of QGraphicsItems that i called mItemsOnScreen. I should be able to get…
3
votes
2 answers

Move QGraphicsItem only when pressing inside the shape. Otherwise, drag scene

I have a QGraphicsView with a bigger QGraphicsScene that can be dragged. In the QGraphicsScene I have a subclassed QGraphicsItem (TestItem) that displays a QGraphicsPixmapItem, which can have random shapes. (I don't use QGraphicsPixmapItem directly…
3
votes
0 answers

How to calculate and set the new position of a QGraphicsItem relative to a new parent's origin?

Question How to calculate and set the new position of a QGraphicsItem relative to a new parent's origin? Background Information I am developing a resizing feature that brings up a bounding box with one anchor upon double-clicking on a given object…
user2514673
  • 109
  • 1
  • 7
3
votes
1 answer

QGraphicsScene::removeItem: item scene is different from this scene

There is something weird with QGraphicsScene::removeItem, when I remove two items from the scene I get the following message: QGraphicsScene::removeItem: item 0x5edb28's scene (0x0) is different from this scene (0x5e7790) QGraphicsScene::removeItem:…
Xlander
  • 1,331
  • 12
  • 24
3
votes
1 answer

GraphicsView fitInView() very pixelated result when downshrinking

I have searched everywhere and i cannot find any solution after 2 days of trying. The Problem: I'm doing an image Viewer with "Fit Image to View" feature. I load a picture of say 3000+ pixels in my GraphicsView (which is a lot smaller ofcourse),…
PathOfNeo
  • 1,089
  • 4
  • 21
  • 39
3
votes
2 answers

Qt graphics performance on soft-float ARM?

I would like to create a car dashboard-like Qt interface (gauges, dials, knobs, etc). My device has a 800x480 LCD powered by a imx287 ARM SoC (armv5te with no hardware float, or GPU). The problem im having is its very slow. A single gauge…
thecoder
  • 55
  • 8
3
votes
1 answer

PyQt/PySide How to access/move QGraphicsItem after having added it to QGraphicsScene

This might be a very uninformed question. I've been trying to figure out QGraphics*, and have run into a problem when trying to move an item (a pixmap) relative to or inside of the QGraphicsView. class…
UrbKr
  • 621
  • 2
  • 11
  • 27
3
votes
2 answers

qt rubberband selection with specific keyboard key

I have a QGraphicsView and a QGraphicsScene and I enabled this->setDragMode(QGraphicsView::RubberBandDrag); for a Rubberband selection. However, in my application it would make sense that you need to press the CTRL key and then move the mouse to…
Captain GouLash
  • 1,257
  • 3
  • 20
  • 33
3
votes
2 answers

Qt: Line connects 2 separate drawings

i want to draw different arbitrary figures. Drawing starts when the mouse is clicked in the graphicsview and ends when stop clicking the mouse. However, when starting at a different point in the graphics view to make a new drawing, or to continue on…
3
votes
1 answer

QT: I need to get coordinates of image added to QGraphicsView via QGraphicsScene

When I add small image to QGraphicsView, is there a way to get coordinates of image pixel? I have used rubberband for my custom class QGraphicsView but I can only get the QGraphicsView coordinates.
Sgt. Pepper
  • 177
  • 11
3
votes
1 answer

QGraphicsView / QGraphicsScene size matching

How do you make a QGraphicsScene with a specified size and a QGraphicsView to monitor that scene with the same size? This sounds like a stupid question but consider the following test code [1] import sys from PyQt4 import QtGui, QtCore class…
kjoppy
  • 457
  • 3
  • 12
3
votes
1 answer

Creating autoscroll feature in QGraphicsView

I have a QGraphicsView and a QGraphicsScene. Depending on user input some QGraphicsItem may be placed on the scene. This item is both selectable and movable. When the scene is larger than the view scrollbars appear (they are set to show when…