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. QPrintDialog Error on QT Windows Environment
Qt 6.11 is out! See what's new in the release blog

QPrintDialog Error on QT Windows Environment

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 5.1k 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.
  • N Offline
    N Offline
    neel2818
    wrote on last edited by
    #1

    Hi All,

    We have wuery regarding QprintDialog.
    Following code we are using for QPrintDialog.

    @
    QPrinter *printer = new QPrinter;
    int total = 0;
    printer->setPageSize(QPrinter::A5);
    printer->setOrientation(QPrinter::Landscape);
    printer->setOutputFileName("./print.pdf");
    QPrintDialog *printDialog = new QPrintDialog(printer, this);

    if (printDialog->exec() == QDialog::Accepted)
    {
    QPainter p(printer);
    .....
    }
    @

    When the above code execute then after printDialog->exec() statement it gives following error.

    @
    QPrintDialog: Cannot be used on non-native printers
    QPrintDialog: Cannot be used on non-native printers
    @

    Interesting is that whne i execute same code in Linux then it execute successfully and also print the page we have given
    But in windows environment it gives above error.
    So what is the issue ?

    Regards,
    Neel

    EDIT: please use @-tags for code highlighting, Gerolf

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sigrid
      wrote on last edited by
      #2

      QPrintDialog can't be used with pdfs on Windows because it is a native print dialog and has no knowledge of Qt's PDF printer.

      1 Reply Last reply
      0

      • Login

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