QPrintDialog Error on QT Windows Environment

  • Hi All,

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

    QPrinter *printer = new QPrinter;
    int total = 0;
    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 ?


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

  • 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.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.