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

Displaying image as background of QGraphicsScene

I try to use QGraphicsView to display a map with some QGraphicItem-subclass showing region centers of the map. Conceptually, I organize the map as follow: QGraphicsView QGraphicsScene QGraphicsPixmapItem : background image, fixed until next…
YamHon.CHAN
  • 866
  • 4
  • 20
  • 36
2
votes
1 answer

Rotating a QGraphicsPixmapItem results in extremly low quality texture

I am using a QGraphicsScene and QGraphicsView to display a QGraphicsPixmapItem. Whenever i rotate the item by anything but 90, 180, 270 degree the texture is displayed in extremly low quality. Image 1 shows the original texture (0° rotation) the 2…
joekr
  • 1,543
  • 1
  • 16
  • 22
2
votes
0 answers

QGraphicsScene to HTML?

Using Qt, I am working on a tool that displays items in a QGraphicsScene. Items are both polygons and QGraphicsTextItems. The latter can contain hyperlinks. Problem: I am trying to export the diagrams and I would like to keep the hyperlinks…
maxime-esa
  • 215
  • 1
  • 9
2
votes
1 answer

Change QGraphicsItem's local Co-Ordinate system to make origin at (0,0)

I have a QGraphicsView and a QGraphicsScene called scene with scene->setSceneRect(0,0,600, 600). I have created a simple custom QGraphicsItem called background with boundingRectangle(0,0,600,600). Very clearly the center of the background item is…
Anjanu
  • 623
  • 2
  • 8
  • 19
2
votes
1 answer

Getting vertices of a QPolygonF

I need to get the vertices of a QPolygonF. This is my code till now class Example(QtGui.QGraphicsScene): def block(self): self.bpoint1 = QtCore.QPointF(150 , 150) self.bpoint2 = QtCore.QPointF(200 , 150) self.bpoint3 =…
Manoj
  • 961
  • 4
  • 11
  • 37
2
votes
1 answer

pyqt - contextmenu for QGraphicsScene

I have a QGraphicsScene and I will display a contextmenu. But nothing happend. Here is my Code: class graphicsScene(QtGui.QGraphicsScene): def __init__ (self, parent = None): super(graphicsScene, self).__init__ (parent) def…
Markus Dod
  • 21
  • 2
2
votes
1 answer

QT QGraphicsScene Drawing Arc

I have a question about drawing specific arc on a scene. I have this information about arc: Starting Koordinates, Start Angle, End Angle , Radius. But I can't use them efficently with QPainter. Actually I tried QPainterPath to use shape to show on…
sikeyim sizi
  • 23
  • 1
  • 6
2
votes
2 answers

QComboBox doesn't show its item list

I have problem with QComboBox as item delegeate editor for QTableWidget. QTableWidget uses SqlTypeDelegate as item delegate. When I draw QTableWidget inside QGraphicsScene(through QGraphicsProxyWidget) then QComboBox popup list of available items is…
msnxcp
  • 71
  • 1
  • 7
2
votes
1 answer

PySide QGraphicsTextItem issues

I am trying to produce a text editor similar to word (paginated) in PySide. The way I decided to tackle this is having a QGraphicsScene with QGraphicsTextItem for each page, and to code the focus by interaction. Now all I am trying to do now is have…
2
votes
3 answers

Render QGraphicsScene according to zoom level

Is there a (quick?) way to render only a subset of GraphicsScene items according to View zoom level? I'm having a big scene with many grid lines and i want to hide/show some of them, when the zoom changes to avoid the 'grid completely fills the…
zw0rk
  • 1,406
  • 1
  • 12
  • 15
2
votes
1 answer

QGraphicsScene::items returns no items for a given rect

I'd like to select all items within a certain area and change their opacity. I'm using QGraphicsScene::items() to do this, but I can't seem to get it to return any items. An example: #include "MainWindow.h" #include "ui_MainWindow.h" #include…
Mitch
  • 23,716
  • 9
  • 83
  • 122
2
votes
1 answer

QMouseEvent, received unexpected type

I'm trying to link a mouse press event to displaying the coordinates of the mouse when clicked in a QLabel. A few problems... when I was passing a generic QWidget.mousePressEvent, the coordinates would only display the first time clicked. When I…
Victoria Price
  • 637
  • 3
  • 13
  • 26
2
votes
1 answer

QGraphicsScene analogous removeAt() and insert() functions?

I have a QGraphicsScene where the order of the items is very important. I'd like to add items at a certain index in the items list (i.e. the list that's returned when items() is called). I know QList has the removeAt() and insert() functions but…
JustinBlaber
  • 4,629
  • 2
  • 36
  • 57
2
votes
1 answer

Resize QGraphicsView doesn't move the widgets

I have a QMainWindows with inside a QGraphicsView that takes all the client area. Inside the view I render some QGraphicsTextItem items. Everything works as long as I don't resize the main window. If I do it, the items stay where they were and don't…
Stefano
  • 3,213
  • 9
  • 60
  • 101
2
votes
2 answers

Qt object signals are not connected to methods(handlers)

I'm faced with a problem to handle clicks in Qt. I have the following class: class MyRectItem : public QObject, public QGraphicsEllipseItem{ Q_OBJECT public: MyRectItem(double x,double y, double w, double h) :…
user1280078
  • 71
  • 1
  • 7