tags:

views:

44

answers:

1

Hi guys

I need to make the tool like Snagit and to take the picture the selected area of the component. I'm searching how to make this tool in Qt.

I firstly prefer using Qt native library but if there is no library which fullfills this requirement, any good c++ libray can be accepted for me.

Any help will be appreciated.

Thanks

+3  A: 

I'm not sure to understand exactly what you want. I assume you want to take a screen shot ? and then put this picture into a PDF document.

To take a screenshot with Qt, have a look at this :

http://doc.qt.nokia.com/4.0/widgets-screenshot.html

This will show you how to take a screenshot (using QDesktopWidget) and get a QPixmap.

You can then display this QPixmap into a QTextDocument (see QTextDocument::addResource) and print this document into a PDF file. Something like this :

QPrinter MyPrinter(QPrinter::HighResolution);
MyPrinter.setOutputFormat(QPrinter::PdfFormat);
MyPrinter.setOutputFileName("test.pdf");
MyPrinter.setPageSize(QPrinter::Letter);
MyPrinter.setColorMode(QPrinter::GrayScale);
MyPrinter.setOrientation(QPrinter::Landscape);

MyTextDocument.print(&MyPrinter);
Jérôme