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

mouseMoveTracking in QtGraphicsScene

I want to track mouse in my main window. I have enabled the moustracking in the QGraphicsView here is the constructor for GraphicsView subclass, the rest is the default behavior. GraphicsView::GraphicsView(QWidget* parent):…
Ring Zero.
  • 459
  • 3
  • 12
1
vote
1 answer

How to paint in colors QtGui.QPainterPath.addRect()?

I am trying to paint rect in PyQt5. But something always is not working with me. I was referring to "QPainterPath documentation' and there was this example : path = QPainterPath() path.addRect(20, 20, 60, 60) path.moveTo(0, 0) path.cubicTo(99, 0, …
Vlad
  • 387
  • 3
  • 17
1
vote
1 answer

Making QGraphicsLineItem less fiddly to drag

As shown below, I've created a QGraphicsLineItem that is draggable. The problem though is that selecting the line is quite fiddly. I'd like to increase the "selection radius" of the line so that its becomes easier to drag from PySide import QtGui,…
Olumide
  • 5,397
  • 10
  • 55
  • 104
1
vote
1 answer

Drawing of infinite line in Qt

I have some problem with drawing in Qt. I need to draw a infinite line on QGraphicsScene with QPainter. And about line I know only base point and line direction (or base point and one more point, that lays on this line). In result, I need something…
misolej
  • 15
  • 4
1
vote
1 answer

Dragging QPixmaps inside QGraphicsScene: how to avoid 'auto' not allowed in lambda parameter

I am trying to implement a custom QGraphicsScene, and when we press the left key, it allows dragging an item, for which I use QDrag and pass the item data, then I overwrite the dropEvent event where I get element and dropEvent new parent. I think…
Emanuele
  • 2,194
  • 6
  • 32
  • 71
1
vote
1 answer

Qgraphicsscene troubles to get scenePos() inside a function

I have subclassed a qgraphicsscene and trying to get the mouse coords inside a "normal" function. I only get it working on "mouse involved" function. Sorry I'm amateur programmer. For exmample here scenePos() works: void…
davintxi
  • 19
  • 3
1
vote
1 answer

How to automatically set rect correctly in QGraphicsView?

I have a couple of different issues that I am trying to solve and I cannot figure out. I have not worked with QGraphicsView etc much before but I created a QGraphicsView that I am trying to load images in and I am trying to use a QSpinBox to…
Richard
  • 445
  • 1
  • 5
  • 21
1
vote
1 answer

QGraphicsItem not staying in place after being moved

I'm currently creating an application that uses QGraphicsView and allows the user to move QGraphicsItems around, so they can create diagram-like structures. I need the items to change color when clicked but change back to their original color when…
1
vote
1 answer

PyQt video frame update signal (Trigger function after each video frame)

I am creating a video player and I need to draw some polygons on top of it. I am using a QGraphicsScene to create this and I need to update the polygons on screen after each frame. I am currently using the QMediaPlayer paired up with a…
Miguel Kulisic
  • 129
  • 2
  • 10
1
vote
1 answer

Resize QGraphicsScene with all QGraphicsItems in it

I have overrided QGraphicsScene with couple of QGraphicsItems in it. I plan to make this scene dynamically resizable with mouse movements. When qgraphicsscene size changes, sizes and positions of items should also change accordingly so that relative…
Bb Gg
  • 23
  • 6
1
vote
1 answer

Determine which ellipse in click event

I'm very new to python and PyQT and have become stuck. So apologies if my code is a bit of a mess. I have spent quite some time searching but haven't yet found anything that helps my situation. I'm trying to identify which ellipse was clicked. I…
xnemesis
  • 62
  • 4
1
vote
0 answers

Which is an analogous of QGraphicsScene in QML?

I'm a developer who has dabbled with QT and created apps using QGraphicsScene and QGraphicsSceneItem descendants. I'd like to learn me some QML and adapt my app to this framework. My question is: which is the best QML component for a QGraphicsScene…
Max Lambertini
  • 3,583
  • 1
  • 19
  • 24
1
vote
1 answer

How to add QML map to QGraphicscene?

The app have QGraphicscene(mpscene) with QGraphicsView(mpGraphicsView) i am trying to add qml map object to QGraphicscene(mpscene) But map view come separately like popup window. How can i add this map to QGraphicscene(mpscene)? Following are the…
Sagar A W
  • 338
  • 1
  • 12
1
vote
1 answer

qcombobox placed on wrong mouse position in qgraphicsscene

Im trying to create a combobox in Qgraphicsscene at the mouse position when spacebar is press. but combobox doesnt seems to be placed in the right position. Please help me. Here is my code class ConsoleScene(QtWidgets.QGraphicsScene): def…
1
vote
1 answer

Is it possible to embed a QWidget inside of a custom QGraphicsWidget?

I would like to embed a QWidget such as a push button or progress bar in my QGraphicswidget, but I have only seen examples of adding a QWidget to a QGraphicsScene i.e. m_scene->addWidget(new QPushButton("Test Test")); In my custom graphics widget I…
Michael Japzon
  • 201
  • 1
  • 2
  • 10