Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How do I print long widgets continuously without cutoff?
Forum Updated to NodeBB v4.3 + New Features

How do I print long widgets continuously without cutoff?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt creatorqprintqpaint
1 Posts 1 Posters 456 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wanyeop
    wrote on 3 Apr 2019, 00:29 last edited by wanyeop 4 Mar 2019, 01:21
    #1

    At QT(5.12), I made the ui with QWidget. And I want to print the ui with my printer. But, The ui is too long to print on one page.(height is greater than the A4 size) I want continuous prints without newPage() function.

    I use QPrinter and QPainter. But, The result I received was a cropped widget image. Is there any option or code that prints automatically on the next page like MS Word?

    QPrinter printer;
    QPainter painter;
    printer.setPaperSize(QPrinter::A4);
    printer.setFullPage(true);
    
    QPrintDialog printDialog(&printer);
    if (printDialog.exec() == QDialog::Accepted) {
        painter.begin(&printer);
        ui->scrollArea->widget()->render(&painter);
    }
    
    1 Reply Last reply
    0

    1/1

    3 Apr 2019, 00:29

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved