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
0
votes
0 answers

Draw part of rectangle intersecting in QGraphicsScene

I have a QGraphicsScene on which I show a video . I have another red colour rectangle which is QGraphicsItem. This rectangle (QGraphicsPixmapItem) lies on the image on QGraphicsScene. I have a yellow rectangular box (QGraphicsItem) which I use to…
Sid411
  • 703
  • 2
  • 9
  • 25
0
votes
1 answer

Drop event gets disabled on QGraphicsScene

I have a QGraphicsScene. I have a video running on the scene. On top of video I add a zooming window which is a QGraphicsItem. I drag and drop this window using drag events of QGraphicsScene. This works fine. I have to show the scene co ordinates…
Sid411
  • 703
  • 2
  • 9
  • 25
0
votes
1 answer

How to get pixel on QGraphicsPixmapItem on a QGraphicsView from a mouse click

I have a QGraphicsScene with a QGraphicsPixmapItem on it, showing an image. I also have a view showing the scene. I have a mousePressEvent() function defined, looking for mouse clicks on the view. The view is setup to contain the pixmap: //pixmap is…
StaringFrog
  • 561
  • 7
  • 21
0
votes
1 answer

Ignore drawForeground() from the scene on the 2nd graphicsview in qt

I have my own QGraphicsScene and two QGraphicView’s. In the QGraphicsScene I use the drawForeground(QPainter *painter, const QRectF &rect) function to draw a grid. Now I want the grid only to be visible in the first, but not in the second view…is…
Captain GouLash
  • 1,257
  • 3
  • 20
  • 33
0
votes
1 answer

Trying to connect QGraphicsScene with custom QGraphicsItemGroup

I have a project on Qt that has a GUI with a QGraphicsView. Then, I have a class called 'GraphicsScene' that is a subclass of 'QGraphicsScene'. After, I have a class called 'Entidade' that is a subclass of 'QGraphicsItemGroup'. When I click on the…
GuiCavi
  • 53
  • 5
0
votes
1 answer

QGraphicsRectItem::pos() function returns something that is not expected?

I have this simple piece of code in a class constructor which is inherited from QGraphicsScene : setSceneRect(0,0,800,800); addRect(sceneRect()); QGraphicsRectItem*r1 = addRect(200, 0, 5, 5); qDebug()<pos(); Here I add a rect at pos(200,0) but…
s4eed
  • 7,173
  • 9
  • 67
  • 104
0
votes
1 answer

QT GraphicScene - Text label collission

I want to stop labels colliding within my Scene and as a result used this code to check for a collision:- QGraphicsTextItem *textLabel = new QGraphicsTextItem; .... addItem(textLabel); //check for collision QList items =…
user1331131
  • 427
  • 6
  • 20
0
votes
1 answer

How to improve memory-consumption when drawing polygons, (poly-)lines and points in Qt?

I'm currently struggling with populating a qgraphicsscene with many (> 1Million) objects (Polygons, Lines, Points). What I've observed is, that when creating randomly 100000 Polygons, I'm already ending up withe 130MB memory consumption. (The simple…
0
votes
1 answer

subclassing qgraphicsview and qgraphicsscene

I have a custom QGraphicsView and a custom QGraphicsScene class. When I create a new custom view I pass in the custom scene to the constructor which calls setScene() on it. But later I am having problems when I call views() on my scene class and it…
0
votes
1 answer

QGraphicsView not drawing line items when zoomed in or moved?

I'm developing a small Qt application similar to the DiagramScene example. I have subclassed QGraphicsView instead of QGraphicsScene. My view is zooming in and out with the mouseWheel, I can drag it with the mouse and I can add Nodes and Links with…
Expr
  • 25
  • 1
  • 5
0
votes
2 answers

How to get the size of QGraphicsView that is in a layout?

I'm new to Qt programming and I am developing a drawing application. I have a class MyWidget which has a member QGraphicsView. MyWidget is a member of another class MainWidget (which has other widgets as well and all of them are in a…
Expr
  • 25
  • 1
  • 5
0
votes
1 answer

Use more QGraphicsScenes

I want to display multiple QML Files on a QWidget. Because every Display should be an unique Object/Widget, I plan to use for every display an own QGraphicsView with an unique QGraphicsScene. These views can be added to a layout witch will be placed…
pck
  • 203
  • 2
  • 10
0
votes
1 answer

QGraphicsPixmapItem won't show over the other QGraphicsPixmapItem

What am I doing wrong here? I expect that "image1.jpg" is shown over "image.jpg" ,at position where I've clicked, but it does not. Here is my code (image1.jpg is 10 times smaller then image.jpg): import sys from PyQt4 import QtGui, QtCore from…
Aleksandar
  • 3,541
  • 4
  • 34
  • 57
0
votes
3 answers

Copying classes derived from QGraphicsItem using memcpy does not creat new object

I have several different classes derived from QGraphicsItem or its children (like QGraphicsRectItem). I am at the point when I need to copy selected objects of those classes while not knowing exactly which one I copy. Since…
0
votes
1 answer

Weird control boundaries detection on QGraphicsProxyWidget

Hello in my application i'm making a QGraphicsView and set the scene on it: QGraphicsProxyWidget *rotateItemIcon; HoverFilter *hv = new HoverFilter(); // my hover filter…
SirLanceloaaat
  • 213
  • 9
  • 18