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
4 answers

Make QGraphicsItem only selectable in one graphicsview

I have a setup where two QGraphicViews display a single QGraphicsScene. One of these views is an overview the other the detail. Imagine something like: The rectangle marking the current boundaries of the detailed view is part of the scene. It is…
P.R.
  • 3,785
  • 1
  • 27
  • 47
1
vote
1 answer

how to change the text added to the scene?

I want to add the text in my scene.and this text sometimes should be changed.how to change the text added to scene ? suppose i have a player that earned points and i put his points in my scene.when his points increase or decrease i have to change…
maryam
  • 1,437
  • 2
  • 18
  • 40
1
vote
1 answer

Can I resize QGraphicsItem without creating a class that inherits QGraphicsItem?

I want to ask a question about can I resize QGraphicsItem without creating a class that inherits QGraphicsItem. For example, something like this: void MyScene::mousePressEvent(QGraphicsSceneMouseEvent *event) { point = event->scenePos(); if(…
Oleksandr Verhun
  • 814
  • 1
  • 8
  • 23
1
vote
0 answers

QGraphicsScene with a QGLWidget as the viewport not rendering QSvgRenderer antialiasing correctly

first I try to describe what I want: I want a (qt 4.8 - based [can but must not]) Opengl-able context set in the background somewhere. Then the first layer has an Image with an transparent ROUND!! hole where you can see the OpenGl context. and on…
1
vote
1 answer

Qt - Using a QTransform (or similar), scale inner QRect to/from QGraphics

Some background - Say you have QGraphicsScene, and only one view, which is a 1-1 scale with the scene. You have a QRect A, which is represents an external view of the scene, with a pre-defined pixel size. You have a QRect A1 which is a smaller…
1
vote
1 answer

deleting user define qGraphicItems after detecting collision

I have a bullet class that I want to delete upon hitting anything but if it hits an enemy, I want it to delete the enemy as well. It was working on my desktop but upon switching to my laptop, it starts crashing whenever it removes. Currently my…
thatboytitz
  • 77
  • 2
  • 6
1
vote
1 answer

C++ Error: because the following virtual functions are pure within

I'm having trouble allocating an object in my class. It feels like I'm doing it right but it's not letting me run. I've looked it up but I can't figure out what I'm doing wrong or different from all the others. I've commented out a bunch of stuff…
thatboytitz
  • 77
  • 2
  • 6
1
vote
1 answer

QGraphicsProxyWidget::setPos(qreal x, qreal y) doesn't place correctly in a QGraphicsScene when coordinates > 2^15

I have a QGraphicsScene of big dimension for displaying a database content. Part of the database is made of pictures that I place in the QGraphicsScene thanks to the method setPos() of a QGraphicsPixmapItem and this works fine with thousands of…
user3581220
  • 11
  • 1
  • 3
1
vote
0 answers

Qt: prevent the mouse from moving outside a QGraphicsScene

I would like to prevent the mouse from moving outside a QGraphicsScene if the mouse is pressed. I tried to use QCursor::setPos ( 0, 0) for example but it is using the screen coordinates. So I think I need to map the coordinates into the scene. I…
Jeanstackamort
  • 309
  • 2
  • 4
  • 16
1
vote
1 answer

pyqtgraph: how to drag a a plot item

Currently trying to plot a scatter plot in pyqtgraph and trying to drag the plot items but unable to find the approach. Already looked at GraphicsScene sigMouseClicked, sigMouseMoved events. Any suggestions welcome. Let me know in case any further…
Versatile
  • 459
  • 5
  • 20
1
vote
2 answers

qt passing object to different class

EDIT I am creating all objects initially when the program is started in my dialog.cpp and storing all QPixmaps in an array then picking a random one from them all. That random QPixmap I want to pass to my maintargets class and draw in the scene…
user3353931
  • 47
  • 2
  • 8
1
vote
1 answer

QTimer won't advance screen

I create my scene in my dialog.cpp and draw some QGraphicsItem's in my scene.cpp. When I add my QTimer to my dialog.cpp it makes whenever I move the cursor over the scene to crash. dialog.cpp #include "dialog.h" #include "scene.h" #include…
user3353931
  • 47
  • 2
  • 8
1
vote
1 answer

Pass mouse events from QGraphicsItem to QGraphicsScene

I have a scene object derived from QGraphicsScene and custom item on it, derived from QGraphicsItem. I want this item be "transparent" for mouse events so clicking on the item area will call QGraphicsScene::mousePressEvent(); From the documentation:…
folibis
  • 12,048
  • 6
  • 54
  • 97
1
vote
0 answers

How can I avoid ambiguous call to parent functions with custom QGraphicsItem?

Let's suppose that there is a scene with several custom QGraphicsItem's. And each such item has ability to scale (I place special anchors to the corners). It work good, as expected. Now I want to group some of items with QGraphicsItemGroup and I…
folibis
  • 12,048
  • 6
  • 54
  • 97
1
vote
0 answers

QGraphicsScene won't scale to page when printing

I am writing a program that, among other things, creates a weekly Outlook-esque schedule (days of the week along the top, times down the left side, and boxes in a grid to represent appointments). I've subclassed the QGraphicsScene class and am using…
Scott M
  • 482
  • 3
  • 14