Blackbelt
Blackbelt

Reputation: 157437

Qt: QGraphicObject and QImage

I have a QGraphicsObject derived class that holds a QImage and ovveride

paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)

In the pain I succefully draw the QImage. The QGraphicsObject is an item of QGraphicsScene, and the latter is inside a QGraphicsView. The QImage dimensions exceed the QGraphicsScene dimensions. My purpose is to drag the QImage (or the QGraphicsObject) in order to show the exceeding part of the QImage. How can I achive this? Have to translate the QImage canvas?

Could point me some kind of docs or example?

thanks

Upvotes: 0

Views: 610

Answers (1)

Stephen Chu
Stephen Chu

Reputation: 12832

It may be easier to just use a QGraphicsPixmapItem and let QGraphicsView handle the dragging for you: http://qt-project.org/doc/qt-4.8/qgraphicsview.html#dragMode-prop

Upvotes: 1

Related Questions