Questions tagged [qgraphicsview]

A QGraphicsView is a class from the Qt toolkit which provides a widget for displaying the contents of a QGraphicsScene.

The QGraphicsView class is part of Qt's Graphics View Framework and is used to visualize the contents of a QGraphicsScene in a scrollable viewport.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

1128 questions
13
votes
3 answers

Events with QGraphicsItemGroup

In my application I want to use QGraphicsItemGroup for grouping items into one item. I played with it a little and not sure using it because when I want to catch events, events are merged together but I want to handle specific event with specific…
onurozcelik
  • 1,214
  • 3
  • 21
  • 44
13
votes
4 answers

How to use the QGraphicsView's translate() function?

here i have a scene and a associated view ,then i hava a position in the scene coordinates.I want to set the center of the viewport with the position.How can i do it? I try to use the translate() function but it didn't work? view->translate(10,…
Ticks
  • 528
  • 1
  • 5
  • 11
12
votes
5 answers

Qt GUI Development - Displaying a 2D grid using QGraphicsView

I'm new to Qt development so I've being trying to research a solution to a user interface I need to design. My project is to simulate players in an online game moving around a global map. To represent the map I need to display a 2D grid, with each…
dlwells02
  • 133
  • 1
  • 2
  • 8
12
votes
1 answer

Draw an item in a static location relative to the QGraphicsView

I would like to draw a notification that always appears in the upper right corner of my QGraphicsView. However, QGraphicsItems positions are specified in scene coordinates, so if the user panned/zoomed to view a different part of the scene, this…
Cory Klein
  • 51,188
  • 43
  • 183
  • 243
12
votes
1 answer

QLabel vs QGraphicsView performance

I am learning QT and I am puzzled by the difference in performance of QLabel and QGraphics view while panning. I read a huge 36Mpixels (D800) jpeg file into either QLabel or QGraphics objects and try to drag the full scale image with…
Alex
  • 389
  • 2
  • 12
11
votes
1 answer

Qt : Efficiently handle QGraphicsItems that have "lots of pixmaps"? (RTS)

I'm currently building up a small Real Time Strategy 2D engine. And I wonder how to handle the many everchanging sprites that will eventually cluter my screen. FYI, I am not aiming at anything AAA level, I'm just trying to implement some machine…
B. Decoster
  • 7,723
  • 1
  • 32
  • 52
11
votes
2 answers

QGraphicsView and eventFilter

This has been bugging me for more than two days now, so i thought i should ask. I am using Qt 4.5.3 (compiled with VC2008) on Win7. I have MyGraphicsView (inherits QGraphicsView) and MyFilter (inherits QObject) classes. When i install the MyFilter…
erelender
  • 6,175
  • 32
  • 49
11
votes
1 answer

Adjusting QPen thickness when scaling QGraphicsView?

One amazing feature of QGraphicsView is its ability to scale itself with its scene's content (every QGraphicsItem inserted in the scene actually). The QPixmap that I have inserted scales correctly, meaning that if I provide a scale factor of 4x4…
Geoffrey R.
  • 1,907
  • 1
  • 19
  • 32
11
votes
5 answers

QGraphicsView and QGraphicsItem: don´t scale item when scaling the view rect

I am using Qt´s QGraphicsView - and QGraphicsItem-subclasses. is there a way to not scale the graphical representation of the item in the view when the view rectangle is changed, e.g. when zooming in. The default behavior is that my items scale in…
Lars Bilke
  • 4,940
  • 6
  • 45
  • 63
10
votes
1 answer

Accepting drops on a QGraphicsScene

I'm trying to implement drag'n'drop for a QGraphicsScene. Here are the events I've overloaded: void TargetScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event) { bool acceptDrag = false; const QMimeData* mime = event->mimeData(); //…
Pieter
  • 31,619
  • 76
  • 167
  • 242
10
votes
3 answers

How to stretch scene to fit graphics view?

I am using Qt and C++ as my environment. I draw a QGraphicsView in my UI, then create a scene and add lines to that it. I run through an array of 5000 points and draw lines connecting each point. QGraphicsScene *scene = new QGraphicsScene(); QPen…
JohnStudio
  • 221
  • 1
  • 7
  • 13
10
votes
2 answers

How should I use a QGraphicsScene with layouts and widgets

I'm creating some graphic data displaying widget in Qt4 and I was tempted to use the QGraphicsScene for it, create QGraphicsItems for the data items etc. However, I wanted to add some layer of controls (eg. scrollbars, zoom+other buttons - I want to…
jpalecek
  • 47,058
  • 7
  • 102
  • 144
9
votes
3 answers

How to pan beyond the scrollbar range in a QGraphicsview?

I am building a node graph in a QGraphicsView and I am currently implementing panning. I used the following question "how to pan images in QGraphicsView" to start but the panning is limited by the scrollbar range. I also tried the translate method…
LBarret
  • 1,113
  • 10
  • 23
9
votes
2 answers

Antialiasing not working in QGraphicsView

I re-implemented QGraphicsView to have the scene zoomed with a mouse wheel event. The scene contains several QGraphicsPixmapItem. The wheel event calls QGraphicsView::scale(qreal sx, qreal sy) Everything works perfectly but the rendering. As I zoom…
Algo
  • 91
  • 1
  • 3
9
votes
2 answers

Changing the cursor in a QGraphicsView

I'm trying to change the cursor of a QGraphicsView while the ScrollHandDrag is on, but it doesn't seem to work. I can change the cursor if I disable the ScrollHandDrag but not while it's active, I don't see what I could possibly be doing…
Leo
  • 1,129
  • 4
  • 23
  • 38
1
2
3
75 76