PDA

View Full Version : Printing a ListWidget



viciv919
7th March 2010, 17:13
Hi
I'm new to QT, so be patient with me!

I want to print what is currently shown in a ListWidget but I have no idea how to do it.

Hope someone can help me

aamer4yu
8th March 2010, 07:06
Do you want to print it to the printer ?
If yes, you will need to render your list widget to the printer.
Have a look at QWidget::render and for the paint device use QPrinter object.

viciv919
9th March 2010, 07:41
Thanks for your reply

Yes I want to print to the printer. I have figured out that I should use QWidget::render and QPrinter but I cant figure out how to use them.
I have searched on different forums and on the Internet without finding something helpful.

Can someone write some examples that shows how to use QWidget::redner and QPrinter?

aamer4yu
9th March 2010, 09:47
Something like -

QPrinter printer(QPrinter::ScreenResolution);
printer.setPageSize(QPrinter::A4);
widget->render(&printer);

Also read - Printing with Qt in Assistant