diff options
author | John Layt <john@layt.net> | 2010-02-16 01:13:13 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond@trolltech.com> | 2010-03-04 14:21:03 (GMT) |
commit | 4984b36c73fb59006a28051ea82bdca0b7aeb457 (patch) | |
tree | d4ef8c6f08866bd73c532ef20ae08a0a946b08bd /src/gui/dialogs/qprintdialog_win.cpp | |
parent | c5264c89b7710dc2f2d8c7c604f0b23852cb2eef (diff) | |
download | Qt-4984b36c73fb59006a28051ea82bdca0b7aeb457.zip Qt-4984b36c73fb59006a28051ea82bdca0b7aeb457.tar.gz Qt-4984b36c73fb59006a28051ea82bdca0b7aeb457.tar.bz2 |
QPrinter: Add Current Page print range support
Support the selection of Current Page option in the print dialog by
activating a new QPrintDialog::PrintDialogOption. If selected the
PrintRange is set to CurrentPage.
It is the responsibility of the application to read the PrintRange and
apply the Current Page selection when rendering the pages.
Merge-request: 2311
Reviewed-by: Trond
Diffstat (limited to 'src/gui/dialogs/qprintdialog_win.cpp')
-rw-r--r-- | src/gui/dialogs/qprintdialog_win.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index fa0c99f..1061660 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -128,11 +128,14 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, if (pd->nMinPage==0 && pd->nMaxPage==0) pd->Flags |= PD_NOPAGENUMS; - // we don't have a 'current page' notion in the QPrinter API yet. - // Neither do we support more than one page range, so limit those - // options - pd->Flags |= PD_NOCURRENTPAGE; + // Disable Current Page option if not required as default is Enabled + if (!pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage)) + pd->Flags |= PD_NOCURRENTPAGE; + + // Default to showing the General tab first pd->nStartPage = START_PAGE_GENERAL; + + // We don't support more than one page range in the QPrinter API yet. pd->nPageRanges = 1; pd->nMaxPageRanges = 1; @@ -153,7 +156,10 @@ static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPri } else if (pd->Flags & PD_PAGENUMS) { pdlg->setPrintRange(QPrintDialog::PageRange); pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); - } else { + } else if (pd->Flags & PD_CURRENTPAGE) { + pdlg->setPrintRange(QPrintDialog::CurrentPage); + pdlg->setFromTo(0, 0); + } else { // PD_ALLPAGES pdlg->setPrintRange(QPrintDialog::AllPages); pdlg->setFromTo(0, 0); } |