[Qt-interest] how to set focus at centre of the pic while zooming

Avishek_Sharma Avishek_Sharma at satyam.com
Wed Jan 7 05:27:04 CET 2009


Thanks Oliver,
Qt::AlignHCenter and Qt::AlignVCenter worked.

----------------------------------------------------------------------------------------------
> ...
> 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

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.




More information about the Qt-interest-old mailing list