Results 1 to 2 of 2

Thread: QPrintDialog - cannot enable page range selection, Win XP - Qt 4.3.0

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Question QPrintDialog - cannot enable page range selection, Win XP - Qt 4.3.0

    Greetings,

    So I have one problem that I cannot seem to figure out no matter how much I tinker with my print code.

    How do you get the specify page range option to appear enabled in the print dialog?

    No matter what I try my print dialog specify page range comes up disabled and will not allow me to print only part of a report. I have tried running the app on numerous machines with no luck.

    Platform: Win XP
    Qt: 4.3.0 Commercial

    Here is a snippet of my code:

    Qt Code:
    1. QPrinter printer(QPrinter::HighResolution);
    2. QPageSetupDialog pageSetupDlg(&printer);
    3. pageSetupDlg.exec();
    4. printer.setFullPage(true);
    5.  
    6. QPrintDialog *dlg = new QPrintDialog(&printer, this);
    7. dlg->addEnabledOption(QAbstractPrintDialog::PrintPageRange);
    8. dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
    9. dlg->addEnabledOption(QAbstractPrintDialog::PrintToFile);
    10.  
    11. if(dlg->exec() == QDialog::Rejected)
    12. {
    13. delete dlg;
    14. return;
    15. }
    To copy to clipboard, switch view to plain text mode 

    Any information would be appreciated.

    ~Cheers

    Quid
    Last edited by Quid; 11th September 2007 at 03:38.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPrintDialog - cannot enable page range selection, Win XP - Qt 4.3.0

    On Windows and Mac OS X, the native print dialog is used, which means that some QWidget and QDialog properties set on the dialog won't be respected. In addition, the native print dialog on Mac OS X does not support setting printer options, i.e. QAbstractPrintDialog::setEnabledOptions() and QAbstractPrintDialog::addEnabledOption() have no effect.
    So I suggest you use the Win print dialog API to enable those options. It is a bit obscure, but you can get it to work.

    Regards

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.