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

QGraphicScene Background

I'm learning PyQt5 to develop a small academy project. I need to set a background for the QGraphicScene, but I'm not able to make the image fit well into the scene. It is sometimes repeaded or too large depending on the scale I apply. Here is my…
Luca Faraoni
  • 175
  • 1
  • 7
2
votes
1 answer

Qt QGraphicsScene how to separate select and unSelect signals?

I am creating an app in qt, and i have come to a problem. I have a qgraphics scene. I create the scene and I have put some actions to take place when the user clicks on a scene item. I can detect the selectionChanged() signals, but: The signal is…
gio
  • 21
  • 1
  • 2
2
votes
1 answer

Using both MouseMoveEvent for QGraphicsScene and HoverEnterEvent for QGraphicsItem

I'm trying to create a program in which you can connect points together with lines. I instantiate QGraphicsEllipseItem into a QGraphicsScene and I use HoverEnterEvent and HoverLeaveEvent to change the color and the size of the ellipses when the…
Théo
  • 35
  • 5
2
votes
1 answer

How can I make QGraphicsEllipseitem's border transparent?

I'm trying to develop Reversi using C++ for core and Qt for GUI. But, I'm having some trouble drawing circle with QGraphics. I'm trying to make circle in picture below transparent but border is not getting transparent. Is there any option that to…
2
votes
2 answers

How to translate/drag/move QGraphicsScene?

I know this question was answered a lot of times especially in C++ version of Qt, but I am not so good in C++ and I can't find the solution. I have a code with QGraphicsView with rectangle made out of QGraphicsPolygonItem in center. I am trying to…
Vlad
  • 387
  • 3
  • 17
2
votes
1 answer

Improve performance of "Accelerate your Widgets with OpenGL" Qt Sample?

I have been studying the Qt Quarterly article about QGraphicsScene and OpenGL for the purpose of using it in a project. I have already decided to use Qt, given its all-round excellence, but have gone down the road of implementing a class derived…
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
2
votes
1 answer

Changing QGraphicsItem stack order with stackBefore

I have a QGraphicsItem "p" with 4 children a, b, c and d, inserted in that order. #include #include #include #include int main(int argc, char…
VSA
  • 43
  • 1
  • 5
2
votes
1 answer

QGraphicsScene item is drawn at twice(x2) position

(warning crossposted on: https://forum.qt.io/topic/105158/qgraphicsscene-item-is-drawn-at-twice-x2-position) In the following code I am creating a custom widget which has a subclass of QGraphicsScene embeded in it. My aim is to click and add a point…
bliako
  • 977
  • 1
  • 5
  • 16
2
votes
1 answer

How can i make 2-layers in QGraphicsView?

In the program below, load the background image and paint it on it. But, I got a problem. In this program, when i use 'eraser' tool, the background image is erased too! Actually, I just want to erase what i painted, except background image. And…
Park changhae
  • 59
  • 1
  • 6
2
votes
2 answers

How to make a ruler on the border of a QGraphicsView

I am working on a small .ui project and I am was trying to understand how to properly make a ruler on a QGraphicsView. So when the use sees the image it looks like the following: But if the user needs to zoom-in (or zoom-out) the ruler moves…
Emanuele
  • 2,194
  • 6
  • 32
  • 71
2
votes
1 answer

Update the Opacity of QGraphicsItem

I want to update the opacity of some QGraphicsItem after the mouse clicking. As suggested from other solution, the QGraphicScene manually update the GraphicsItem after the mouser press event. I have tried different setOpacity() and update() in…
S.H.
  • 35
  • 6
2
votes
1 answer

How to add multiple objects to the scene?

A set of handles has been created that can be used to resize a shape. By tracking the changes in the position of the handles, you calculate the new geometry of the shape. I can not add multiple objects to the scene. import sys from PyQt5.QtCore…
2
votes
0 answers

How to get drag and drop events in GraphicsItem which is placed in GraphicsScene?

I have graphicsview(attached graphicscene)setted as a centralwidget in scene i added 2 rect items(graphicsItem) (both are draggable). when i drag 1 rect item when its scene it gets drag enter event but when enters to other rect item its not getting…
2
votes
2 answers

QRectF doesn't appear in my QGraphicsScene

I am trying to play around with QGraphicsView(inside Maya) and got some code which I will paste down bellow. Problem is that window with QGraphicsView coming , but looks like QGraphicsScene(with my QRectF) doesn't come. I am a little bit still…
Vlad
  • 387
  • 3
  • 17
2
votes
1 answer

How to prevent default context menu on QGraphicsTextItem?

Is it possible to prevent right-click from opening the default context menu on QGraphicsTextItem ? The menu with "Undo, Redo, Cut, Copy, Paste..". On Ubuntu 18.04, that is. I don't know how this behaves on Windows. I have overridden the mouse press…
juzzlin
  • 45,029
  • 5
  • 38
  • 50