Results 1 to 4 of 4

Thread: Printing a ListWidget

  1. #1
    Join Date
    Mar 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Question Printing a ListWidget

    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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Printing a ListWidget

    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.

  3. #3
    Join Date
    Mar 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Printing a ListWidget

    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?

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Printing a ListWidget

    Something like -
    Qt Code:
    1. QPrinter printer(QPrinter::ScreenResolution);
    2. printer.setPageSize(QPrinter::A4);
    3. widget->render(&printer);
    To copy to clipboard, switch view to plain text mode 

    Also read - Printing with Qt in Assistant

Similar Threads

  1. ListWidget positions item
    By talex in forum Qt Programming
    Replies: 3
    Last Post: 21st October 2008, 15:16
  2. QValidator and ListWidget
    By csvivek in forum Qt Programming
    Replies: 4
    Last Post: 9th July 2008, 19:19
  3. listWidget resize
    By buckadl in forum Qt Tools
    Replies: 3
    Last Post: 12th June 2007, 20:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.