views:

72

answers:

2

I am using Qt 4.5 and a qgraphicsscene/view to show video to the user. I would like to provide a "take a snapshop" button and I am sure that there is a pretty straightforward way much simpler of everything I am thinking about. How can I do this elegantly?

BTW, the code is here : http://gitorious.org/handy

+6  A: 

You can use the static method QPixmap::grabWidget(). This method renders the given widget to a pixmap and returns that pixmap. Then you can do whatever you like with that, like saving to a file using QPixmap::save().

erelender
+1  A: 

See QPixmap::grabWindow and QPixmap::grabWidget.

With grabWindow you can even capture a window outside of your application, e.g. the screenshot example program:

http://doc.trolltech.com/4.6/desktop-screenshot.html

Hostile Fork