Results 1 to 13 of 13

Thread: problem printing a multi page report

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Oct 2009
    Posts
    364
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    10
    Thanked 37 Times in 36 Posts

    Default Re: problem printing a multi page report

    Consider this code:
    Qt Code:
    1. void MainWindow::print(QPrinter *printer)
    2. {
    3. QTextEdit textEdit[2];
    4.  
    5. textEdit[0].append("First Page");
    6. textEdit[1].append("Second page");
    7.  
    8.  
    9. textEdit[0].print(printer);
    10. printer->newPage();
    11. textEdit[1].print(printer);
    12.  
    13. }
    14.  
    15. void MainWindow::on_pushButton_clicked()
    16. {
    17.  
    18. QPrinter printer(QPrinter::HighResolution);
    19. QPrintPreviewDialog preview(&printer,this);
    20. connect(&preview, SIGNAL(paintRequested(QPrinter*)),SLOT(print(QPrinter *)));
    21. preview.exec();
    22.  
    23.  
    24. }
    To copy to clipboard, switch view to plain text mode 

    I get a single page print preview showing 'second page' and a page number '1' at the bottom.

    where did the first page go?
    Last edited by schnitzel; 17th January 2011 at 18:02.

Similar Threads

  1. multi page Application
    By ilpaso in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2010, 09:36
  2. Printing to a plain text (txt) file from a report
    By luizofoca in forum Qt Programming
    Replies: 0
    Last Post: 10th June 2010, 19:02
  3. Printing custom report with QWT
    By maluedo in forum Qwt
    Replies: 2
    Last Post: 6th April 2010, 11:09
  4. Replies: 1
    Last Post: 10th February 2009, 06:21
  5. Multi-Page PDF Output
    By igor in forum Qt Programming
    Replies: 1
    Last Post: 9th January 2007, 04:10

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.