PDA

View Full Version : Mouse magnifying-glass?



jomotix
10th January 2011, 15:16
hey!

I am using PyQt and would like to have an mouse-cursor that like this one:

http://static.rbytes.net/fullsize_screenshots/m/a/magnifying-glass-pro.jpg (i do not need any transparency thou, just a basic zoom)

i'm quite new to Qt, so do i need to do this all from scratch or are there any good tipps for me to get to a quick solution? I tried google but did not find what i'm looking for (for sure i am not the only one wanting a mouse-zoom-cursor, am i?)

THANKS!

wysota
10th January 2011, 15:25
For a quick start have a look at QPixmap::grabWidget(), QPixmap::grabWindow() and QWidget::render(). It's a good guess something like this would work (it's C++ but you can translate it to python easily):


QPixmap px(twice_the_width_to_be_zoomed, twice_the_height_to_be_zoomed);
QPainter painter(&px);
painter.scale(2,2); // scale up the result twice in each direction
widget->render(painter, ...);

Then just show the resulting pixmap where you want it.