summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs/qprintdialog_unix.cpp
diff options
context:
space:
mode:
authorJohn Layt <john@layt.net>2010-02-16 01:13:13 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2010-03-04 14:21:03 (GMT)
commit4984b36c73fb59006a28051ea82bdca0b7aeb457 (patch)
treed4ef8c6f08866bd73c532ef20ae08a0a946b08bd /src/gui/dialogs/qprintdialog_unix.cpp
parentc5264c89b7710dc2f2d8c7c604f0b23852cb2eef (diff)
downloadQt-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_unix.cpp')
-rw-r--r--src/gui/dialogs/qprintdialog_unix.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp
index 2d169cf..0487f23 100644
--- a/src/gui/dialogs/qprintdialog_unix.cpp
+++ b/src/gui/dialogs/qprintdialog_unix.cpp
@@ -502,6 +502,9 @@ void QPrintDialogPrivate::setupPrinter()
} else if (options.printSelection->isChecked()) {
p->setPrintRange(QPrinter::Selection);
p->setFromTo(0,0);
+ } else if (options.printCurrentPage->isChecked()) {
+ p->setPrintRange(QPrinter::CurrentPage);
+ p->setFromTo(0,0);
} else if (options.printRange->isChecked()) {
p->setPrintRange(QPrinter::PageRange);
p->setFromTo(options.from->value(), qMax(options.from->value(), options.to->value()));
@@ -518,10 +521,12 @@ void QPrintDialogPrivate::updateWidgets()
{
Q_Q(QPrintDialog);
options.gbPrintRange->setVisible(q->isOptionEnabled(QPrintDialog::PrintPageRange) ||
- q->isOptionEnabled(QPrintDialog::PrintSelection));
+ q->isOptionEnabled(QPrintDialog::PrintSelection) ||
+ q->isOptionEnabled(QPrintDialog::PrintCurrentPage));
options.printRange->setEnabled(q->isOptionEnabled(QPrintDialog::PrintPageRange));
options.printSelection->setVisible(q->isOptionEnabled(QPrintDialog::PrintSelection));
+ options.printCurrentPage->setVisible(q->isOptionEnabled(QPrintDialog::PrintCurrentPage));
options.collate->setVisible(q->isOptionEnabled(QPrintDialog::PrintCollateCopies));
switch (q->printRange()) {
@@ -534,6 +539,10 @@ void QPrintDialogPrivate::updateWidgets()
case QPrintDialog::PageRange:
options.printRange->setChecked(true);
break;
+ case QPrintDialog::CurrentPage:
+ if (q->isOptionEnabled(QPrintDialog::PrintCurrentPage))
+ options.printCurrentPage->setChecked(true);
+ break;
default:
break;
}