[Qt-jambi-interest] Widget Size 0? How to show large pixmpa in a small viewport without loosing pixmap data
Eskil Abrahamsen Blomfeldt
eblomfel at trolltech.com
Thu Apr 17 18:06:45 CEST 2008
Hi, Dawid.
Dawid Sip wrote:
> GraphicsView -pos(150,200) I can transform this down to the item and
> get somethink like pos(1250x1000). So I somehow need to adjust the
> projection. I think this is an issue of the viewport. I think I could
> achieve this by changing the viewport to QGLWidget and with help of
> some wrapper lib. like JOGL adjust the viewport/frustum, but I'd
> rather not use OpenGL in my application. So is this the only way or
> can I still do this with the default QWidget as viewport?
>
> Sow the question is: "How to show large pixmpa in a small viewport
> without loosing pixmap data"
>
> Could somebody please point me in the right direction?
>
The graphics view has the possibility of setting any transform/matrix on
it to alter how and which part of the scene is displayed. For your
particular case there is also a convenience method which sets the
correct scale on the view so that a specific item fits perfectly inside it.
http://doc.trolltech.com/qtjambi-4.4.0_01/doc/html/com/trolltech/qt/gui/QGraphicsView.html#fitInView(com.trolltech.qt.gui.QGraphicsItemInterface)
I have attached a modification to the previous example of how you can
use this method to achieve what you need. Please make sure you set the
scrollbar policy of the view to no scrollbars in both vertical and
horizontal direction, though, otherwise you will get an infinite stream
of resize events as the scrollbars automatically switch on and off.
Hope this helps.
-- Eskil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: guiSplit.java
Type: text/java
Size: 2381 bytes
Desc: not available
Url : http://lists.trolltech.com/pipermail/qt-jambi-interest/attachments/20080417/9ba3f2ec/attachment.bin
More information about the Qt-jambi-interest
mailing list