Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

printer pdfformat cancel closes print preview window.



  • I have a print preview dialog when i click on the print button it opens a dialog box and i can enter the file name of the pdf file. but when i press cancel it closes the dialog box and print preview window is this designed this way or a bug?

    QPrinter printer( QPrinter::HighResolution );
           printer.setOutputFormat(QPrinter::PdfFormat);
           printer.setOrientation( QPrinter::Portrait);
           printer.setPageMargins(QMarginsF(12.5, 12.5, 12.5, 12.5), QPageLayout::Millimeter);
    
           QPrintPreviewDialog  preview( &printer, this );
           connect( &preview, SIGNAL(paintRequested(QPrinter*)), SLOT(displayonly(QPrinter*)) );
           connect( &preview, SIGNAL(destroyed(QObject*)), SLOT(Change()));
           preview.exec();
    

  • Lifetime Qt Champion

    Hi,

    What does the Change slot do ?



  • @SGaist i have a tab widget and it just switches to it.


  • Lifetime Qt Champion

    Can you show the complete code you are using, including the call to your custom dialog to get the file path ?


Log in to reply