1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the dialog module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "qabstractprintdialog.h"
30
#include "qabstractprintdialog_p.h"
33
\class QAbstractPrintDialog
34
\brief The QAbstractPrintDialog class provides a base implementation for
35
print dialogs used to configure printers.
39
\enum QAbstractPrintDialog::PrintRange
41
Used to specify the print range selection option.
43
\value AllPages All pages should be printed.
44
\value Selection Only the selection should be printed.
45
\value PageRange The specified page range should be printed.
49
\enum QAbstractPrintDialog::PrintDialogOption
51
Used to specify which parts of the print dialog should be enabled.
53
\value None None of the options are enabled.
54
\value PrintToFile The print to file option is enabled.
55
\value PrintSelection The print selection option is enalbed.
56
\value PrintPageRange The page range selection option is enabled.
57
\value PrintCollateCopies
61
Constructs an abstract print dialog for \a printer with \a parent
64
QAbstractPrintDialog::QAbstractPrintDialog(QPrinter *printer, QWidget *parent)
65
: QDialog(*(new QAbstractPrintDialogPrivate), parent)
67
Q_D(QAbstractPrintDialog);
74
QAbstractPrintDialog::QAbstractPrintDialog(QAbstractPrintDialogPrivate &ptr,
77
: QDialog(ptr, parent)
79
Q_D(QAbstractPrintDialog);
85
Sets the set of options that should be enabled in the print dialog
88
void QAbstractPrintDialog::setEnabledOptions(PrintDialogOptions options)
90
Q_D(QAbstractPrintDialog);
95
Adds the option \a option to the set of enabled options in this dialog.
97
void QAbstractPrintDialog::addEnabledOption(PrintDialogOption option)
99
Q_D(QAbstractPrintDialog);
100
d->options |= option;
104
Returns the set of enabled options in this dialog.
106
QAbstractPrintDialog::PrintDialogOptions QAbstractPrintDialog::enabledOptions() const
108
Q_D(const QAbstractPrintDialog);
113
Returns true if the option \a option is enabled; otherwise returns false
115
bool QAbstractPrintDialog::isOptionEnabled(PrintDialogOption option) const
117
Q_D(const QAbstractPrintDialog);
118
return d->options & option;
122
Sets the print range option in to be \a range.
124
void QAbstractPrintDialog::setPrintRange(PrintRange range)
126
Q_D(QAbstractPrintDialog);
127
d->printRange = range;
131
Returns the print range.
133
QAbstractPrintDialog::PrintRange QAbstractPrintDialog::printRange() const
135
Q_D(const QAbstractPrintDialog);
136
return d->printRange;
140
Sets the page range in this dialog to be from \a min to \a max. This also
141
enables the PrintPageRange option.
143
void QAbstractPrintDialog::setMinMax(int min, int max)
145
Q_D(QAbstractPrintDialog);
146
Q_ASSERT_X(min <= max, "QAbstractPrintDialog::setMinMax",
147
"'min' must be less than or equal to 'max'");
150
d->options |= PrintPageRange;
154
Returns the minimum page in the page range.
156
int QAbstractPrintDialog::minPage() const
158
Q_D(const QAbstractPrintDialog);
163
Returns the maximum page in the page range.
165
int QAbstractPrintDialog::maxPage() const
167
Q_D(const QAbstractPrintDialog);
172
Sets the range in the print dialog to be from \a from to \a to.
174
void QAbstractPrintDialog::setFromTo(int from, int to)
176
Q_D(QAbstractPrintDialog);
177
Q_ASSERT_X(from <= to, "QAbstractPrintDialog::setFromTo",
178
"'from' must be less than or equal to 'to'");
182
if (d->minPage == 0 && d->maxPage == 0)
187
Returns the first page to be printed
189
int QAbstractPrintDialog::fromPage() const
191
Q_D(const QAbstractPrintDialog);
196
Returns the last page to be printed.
198
int QAbstractPrintDialog::toPage() const
200
Q_D(const QAbstractPrintDialog);
205
Returns the printer that this printer dialog operates
208
QPrinter *QAbstractPrintDialog::printer() const
210
Q_D(const QAbstractPrintDialog);
215
\fn int QAbstractPrintDialog::exec()
217
This virtual function is called to pop up the dialog. It must be
218
reimplemented in subclasses.
222
\class QPrintDialog qprintdialog.h
224
\brief The QPrintDialog class provides a dialog for specifying
225
the printer's configuration.
229
It encompasses both the sort of details needed for doing a simple
230
print-out and some print configuration setup.
232
Typical use of the QPrintDialog is to construct it on a QPrinter
233
object and call exec() to execute it.
236
QPrintDialog printDialog(printer, parent);
237
if (printDialog.exec() == QDialog::Accept) {
242
The printer dialog in Motif style:
248
\fn QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent)
250
Constructs a new modal printer dialog for the given \a printer
251
with the given \a parent.
255
\fn int QPrintDialog::exec()
257
Launches the print dialog.
259
\sa QDialog::DialogCode, accept(), reject()