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

Qt 5.3.2, QPrintDialog and Microsoft XPS Writer



  • Hi. I'm trying to print some page into some .xsp file. And I have error. I don't have normal printer. But when I'm tryig to print into some .pdf file with only Qt it works.

    @printer = new QPrinter();
    QPainter painter(printer);
    printer->setOutputFileName("C:\output.pdf");@

    But when I'm trying not to set file name and open XPS Writer, dialog where you can choose file name doesn't appear

    @QPrintDialog dlg(parent);

    if(dlg.exec() == QDialog::Accepted) {
    printer = dlg.printer();
    }
    else {
    return;
    }
    QPainter painter(printer);@

    And I have error here (C:\Qt\qt-5.3.2-openSSL\qt-everywhere-opensource-src-5.3.2\qtbase\src\gui\painting)
    @
    bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
    {
    Q_ASSERT(q);
    Q_ASSERT(pdev);

    QPainter *sp = pdev->sharedPainter();@
    

    Why is so? What shall I do? Show some Save To dialog? Or this is bug?

    Thank you


Log in to reply