[Qt-interest] how to set focus at centre of the pic while zooming
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Tue Jan 6 14:28:57 CET 2009
Avishek_Sharma wrote on Tuesday, January 06, 2009 2:08 PM:
> ...
> I am displaying this enlarged picture on a 'TextLabel'.When I try to
> zoom this enlarged pic, I would prefer the focus to be at the centre
> of the pic.In my case it's on the top left side of the pic.
There's no Qt class called QTextLabel, so I assume you mean QLabel (which is cabable of showing both QPixmaps and text).
Try the alignment flags:
http://doc.trolltech.com/3.3/qt.html#AlignmentFlags-enum
http://doc.trolltech.com/3.3/qlabel.html#setAlignment
(Go for Qt::AlignHCenter and Qt::AlignVCenter)
Not sure if they help, could be that they only affect text.
In this case I would implement a custom widget and translate the zoomed pixmap accordingly when painting it:
http://doc.trolltech.com/3.3/qpainter.html#translate
and a bit of easy math should help ;)
Happy New Year,
Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list