Results 1 to 2 of 2

Thread: QPritner, as-is in a book

  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QPritner, as-is in a book

    I jsut copied a code found in a book on Qt (5 stars ranking in Amazon!).
    [
    Qt Code:
    1. void PrintWindow::printHtml(const QString &html)
    2.  
    3. {
    4. QPrintDialog printDialog(&printer,this);
    5. if (printDialog.exec())
    6. {
    7. QPainter painter;
    8. painter.begin(&printer);
    9. QTextDocument textDocument;
    10. textDocument.setHtml(html);
    11. textDocument.print(&printer);
    12. }
    13.  
    14. }
    To copy to clipboard, switch view to plain text mode 

    The dialog opens, but nothing will be printed. Same, if I try to print on a file (ps or pdf). The file cannot be read by kpdf or acrobat, and the printer does not start.
    Any suggestion?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPritner, as-is in a book

    Does richtext/orderform example work for you?

Similar Threads

  1. Qt 4 book 2nd Edition legally and freely available as ebook?
    By jamadagni in forum General Discussion
    Replies: 0
    Last Post: 17th May 2008, 11:57
  2. "Thinking in C++" vol 2 book
    By mickey in forum General Discussion
    Replies: 2
    Last Post: 15th April 2008, 13:21
  3. Choosing a qt4 book
    By asieriko in forum General Discussion
    Replies: 14
    Last Post: 7th October 2007, 14:31
  4. Any opinions of other Qt book?
    By brcain in forum General Discussion
    Replies: 4
    Last Post: 22nd September 2006, 22:49
  5. Note book widget
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 30th May 2006, 19:02

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.