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

How to make a QGraphicsItem's position dependent on another QGraphicsItem?

I want to make one QGraphicsItem in a QGraphicsScene move (or change size) when another one moves. But, trying to access either QGraphicsItem from the QGraphicsScene object causes crashes. Here's a dummy example. I want to automatically: Resize…
Graeme Rock
  • 601
  • 5
  • 21
1
vote
0 answers

Qt Not displaying PNG on QGraphicsView

Please note: I am a Qt newbie. Purpose: I am attempting to display a PNG on a GraphicsView object on a UI form Tried: I have been following a simple solution, from this post, for displaying a PNG, but have had no luck. My PNG does not display onto…
CybeX
  • 2,060
  • 3
  • 48
  • 115
1
vote
0 answers

QGraphicsScene many widgets

I have more than one widget in QGraphicsScene. The first created widget is on top of scene, other widgets is under first widget. I want such functionality - if i press one of widget it will be on top of the scene. How i can make it? Also i don't…
abdallah allam
  • 73
  • 1
  • 13
1
vote
1 answer

Simplifying a Qt program and I am having trouble displaying an image in Qt using QGraphicsScene

Both of these code segments load in an image. Code 1, loads an image and has a zoom function and Code 2 is supposed to only load an image. Code 1 works perfectly, but when I tried to simplify it, I lost the load image functionality. For some reason…
1
vote
1 answer

Getting the pixels index covered by qpen while using qpainter on qimage

I am using qt for developing a simple drawing application. I have a qImage and filled it as trasparent. QImage *m_markerImg = new QImage(400,320, QImage::Format_ARGB32_Premultiplied); m_markerImg -> fill( Qt::transparent ); I have created a custom…
1
vote
1 answer

Drag and drop on a QGraphicScene - mouse cursor in center of widget

I want the mouse cursor to be in the position where the mouse was clicked on the widget or in the center of the widget. For example if the widget is a rectangle and it is in drag event it appears like in the image below, event I've clicked in the…
mtb
  • 1,350
  • 16
  • 32
1
vote
0 answers

How to visualize fast dynamic 2D data in Qt

I am currently writing a real-time visualization tool for processing simulation data. The data are two-dimensional data like a pressure/temperature field. Currently, I am using QImage to manipulate the data and QPixmap to display those data but are…
Bui Thanh Binh
  • 103
  • 1
  • 10
1
vote
1 answer

QStateMachine how to show and hide QGraphicsView and QObject in different QState

this is my simple code: I've created a new scene, view and QPixmapItem QGraphicsScene *scena = new QGraphicsScene(); QGraphicsPixmapItem *object1= new QGraphicsPixmapItem(); object1->setPixmap(QPixmap(":/prova/prova.png")); QGraphicsView *view =…
1
vote
0 answers

Force repaint of entire viewport of QGraphicsScene

I need to force a repaint of a QGraphicsScene inside a view - the entire view. I am explaining below why I can't repaint specific items, and what I have tried. I have a QGraphicsScene subclass that paints an "actual canvas rectangle" for items - but…
Thalia
  • 13,637
  • 22
  • 96
  • 190
1
vote
1 answer

Move an embedded widget in QGraphicsProxyWidget in a QGraphicsView/QGraphicsScene

I am trying to move with the mouse a push button on a QGraphicsView but is not working, some body can help me whit my issue? int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow windows; QGraphicsScene scene(&windows); …
1
vote
0 answers

how to set background color of qlineedit when it's a widget in qgraphics scene

Using PyQt, I'm trying to use a stylesheet to set the background color of a QLineEdit that I've added to a QGraphicsScene. Problem is the background color is the only property I can't seem to change. For example: import sys from PyQt5.QtWidgets…
1
vote
1 answer

QGraphicsscene: How to implement selection (by rubber band) behavior of QGraphicsItems?

so I know there are quite a lot of similar questions on here but none really gets to the specific point I am interested in. I want to implement custom selection behavior of a QGraphicsItems (e.g. change its color on selection). Apparently this is…
Chris K
  • 1,376
  • 1
  • 14
  • 18
1
vote
0 answers

How to use custom functions to convert between QGraphicsView and QGraphicsScene coordinates?

I am trying to develop an application that makes the most of (Py)Qt Graphics Framework applied to Geographical Maps (think rendering KML files over a tiled background, very similar to Google Maps). On Web Maps, the conversion between pixels…
heltonbiker
  • 26,657
  • 28
  • 137
  • 252
1
vote
1 answer

QT Graphic scene/view - moving around with mouse

I created my own classes (view and scene) to display image and objects I added to it, even got zoom in/out function implemented to my view, but now I have to add new functionality and I don't even know how to start looking for it. Whenever I press…
Arker
  • 169
  • 2
  • 14
1
vote
1 answer

QGraphicsScene - App hangs for a long when adding big transparent pixmap with small amount of opaque dots

When I add QGraphicsPixmapItem to scene and after first mouse click program freeze for long. Why? Or how i can exclude this from Qt's inner computations (if only i know what happens behind..) *.h #include #include…
user3444737
  • 41
  • 1
  • 7