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 remove boundary line of QPushButton which is added on QGraphicsView&Scene

I am creating a simple program with Qt Creator. QPushButton has been inserted in QGraphicsView & QGraphicsScene. However, there is a gray boundary line around the inserted PushButton, as shown below picture. I tried to remove it using StyleSheet as…
YOLOGO
  • 23
  • 1
  • 6
1
vote
1 answer

Composed QGraphicsItem not detecting clicks on sub-items

I am trying to make a simple extension of QGraphicsRectItem that allows me to resize the rectangle and move it around with the mouse. I model the handles with elliptical arches on the corners I want to enable for dragging, which I implement as…
GPhilo
  • 18,519
  • 9
  • 63
  • 89
1
vote
1 answer

How to delete selected Graphics item group?

In a scene with multiple groups, how can I delete the selected item group? When I try to delete the group, it only deletes the last created group. #include "graphicscene.h" QGraphicsItemGroup *mpGroup ; void…
Sagar A W
  • 338
  • 1
  • 12
1
vote
2 answers

Tooltip for widget inside a QGraphicsProxyWidget

I've got a QGraphicsScene in which I added QPushButtons inside QGraphicsProxyWidgets. Is there a way to display tooltips for those buttons? The setToolTip works but nothing appear when I hover on the buttons. Do I need to specify some flag on the…
Loukana
  • 23
  • 6
1
vote
1 answer

how to get drop events of object which is placed in graphic scene?

i have graphic view(QGraphics view) setted scene(QGraphic scene) i am dropping objects on scene its working fine, i have to assign parameter for dropped object by dragging parameter from parameter list .i have implemented drag drop events of…
Sagar A W
  • 338
  • 1
  • 12
1
vote
2 answers

slow response on right click contex menu in graphic scene Qt

I have set a large menu in event filter on right click with 45-50 actions inside and I find that when I right click the response to show the menu is slow I did try the same code with 5 actions in the menu and the response was fine. Is there…
Sonicpath
  • 231
  • 4
  • 16
1
vote
1 answer

How do I translate the QGraphicView to the position where I doulbleclicked?

I'm trying to translate the position of the QGraphicView to the position where I doubleclicked on. I tried the function translate and centerOn but none of them work. So I'm gessing I'm doing something wrong. For a simple example, if I use this…
ymmx
  • 4,769
  • 5
  • 32
  • 64
1
vote
1 answer

geometry of QGraphicsRectItem

I have a qgraphicsRectItem drawn on a qgraphicsScene. With mouse events, it's being moved over the scene, resized and repositioned, ie, select the item, mousePress and mouseMove. How can I get the geometry of that qgraphicsRectItem boundingRect, pos…
Sayan Bera
  • 135
  • 2
  • 16
1
vote
1 answer

Mouse position in mouseMoveEvent and mousePressEvent are different: QGraphicsObject

Mouse position in mouseMoveEvent and mousePressEvent are different in the following example. This is happening due to the added scaling. Without scaling the positions are same. Do I have to update the boundingRect according to the changed scaling?…
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
1
vote
1 answer

QGraphicsScene position problems

So i trying to do paint and i run into some problems. When i try to draw QGraphicsRectItem it doesnt get positioned where i want it. QColor neki1(23, 145, 195); QPen pen1(neki1, 2, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin); QGraphicsRectItem* sel =…
Tim Retelj
  • 19
  • 1
1
vote
1 answer

How do I auto zoom a chart in Qt when window size change?

I create a chart with QChart & QGraphicsScene & QGraphicsView, but the chart does not auto zoom in or zoom out when window change. How could I do that? I don't there is any signal or slot in QChart, QGraphicsScene, or QGraphicsView class. I know I…
Darcy
  • 13
  • 4
1
vote
1 answer

Drawing Text In a QGraphicsWidget::paint function

I'm trying to draw text inside a qgraphicswidget. The scale of the scene is -180 to 180 in the horizontal and -90 to +90 in the vertical (it's a world map). When i zoom in to individual items on the map, i want some text to show up. My code for the…
jasonlg3d
  • 484
  • 2
  • 7
  • 18
1
vote
1 answer

QGraphicsScene width/height is not changing after the window was resized manually

I have an application composed from graphics view and graphics scene. The basic GUI structure is this (done in Qt Creator): QMainWindow QWidget (centralWidget) QGridLayout QVBoxLayout QGraphicsView This is my code for the…
T.Poe
  • 1,949
  • 6
  • 28
  • 59
1
vote
0 answers

set QGraphicsScene dynamically in QGraphicsView with OpenGL Viewport

I have a problem, i'm developing a graphical program under Windows, there are few QGraphicsScene and one QGraphicsView that it is possible to change the Scenes in runtime with a lot of graphics items, the problem is when I use Qwidget viewport…
Hamed T
  • 11
  • 3
1
vote
0 answers

Displaying overlayed QGraphicsItems

I have developed an application in PyQt5 that displays an image and allows the user to pan the image using the mouse and zoom using the mouse wheel. I now need to add the functionality to show popup text associated to specific parts of the displayed…