1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #include <private/qabstractpagesetupdialog_p.h>
|
---|
43 |
|
---|
44 | #ifndef QT_NO_PRINTDIALOG
|
---|
45 |
|
---|
46 | QT_BEGIN_NAMESPACE
|
---|
47 |
|
---|
48 | /*!
|
---|
49 | \class QPageSetupDialog
|
---|
50 |
|
---|
51 | \brief The QPageSetupDialog class provides a configuration dialog
|
---|
52 | for the page-related options on a printer.
|
---|
53 |
|
---|
54 | \ingroup standard-dialogs
|
---|
55 | \ingroup printing
|
---|
56 |
|
---|
57 | On Windows and Mac OS X the page setup dialog is implemented using
|
---|
58 | the native page setup dialogs.
|
---|
59 |
|
---|
60 | Note that on Windows and Mac OS X custom paper sizes won't be
|
---|
61 | reflected in the native page setup dialogs. Additionally, custom
|
---|
62 | page margins set on a QPrinter won't show in the native Mac OS X
|
---|
63 | page setup dialog.
|
---|
64 |
|
---|
65 | In Symbian, there is no support for printing. Hence, this dialog should not
|
---|
66 | be used in Symbian.
|
---|
67 |
|
---|
68 | \sa QPrinter, QPrintDialog
|
---|
69 | */
|
---|
70 |
|
---|
71 |
|
---|
72 | /*!
|
---|
73 | \fn QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent)
|
---|
74 |
|
---|
75 | Constructs a page setup dialog that configures \a printer with \a
|
---|
76 | parent as the parent widget.
|
---|
77 | */
|
---|
78 |
|
---|
79 | /*!
|
---|
80 | \since 4.5
|
---|
81 |
|
---|
82 | \fn QPageSetupDialog::QPageSetupDialog(QWidget *parent)
|
---|
83 |
|
---|
84 | Constructs a page setup dialog that configures a default-constructed
|
---|
85 | QPrinter with \a parent as the parent widget.
|
---|
86 |
|
---|
87 | \sa printer()
|
---|
88 | */
|
---|
89 |
|
---|
90 | /*!
|
---|
91 | \fn QPrinter *QPageSetupDialog::printer()
|
---|
92 |
|
---|
93 | Returns the printer that was passed to the QPageSetupDialog
|
---|
94 | constructor.
|
---|
95 | */
|
---|
96 |
|
---|
97 | // hack
|
---|
98 | class QPageSetupDialogPrivate : public QAbstractPageSetupDialogPrivate
|
---|
99 | {
|
---|
100 | };
|
---|
101 |
|
---|
102 | /*!
|
---|
103 | \enum QPageSetupDialog::PageSetupDialogOption
|
---|
104 | \since 4.4
|
---|
105 |
|
---|
106 | Used to specify options to the page setup dialog
|
---|
107 |
|
---|
108 | This value is obsolete and does nothing since Qt 4.5:
|
---|
109 |
|
---|
110 | \value DontUseSheet In previous versions of Qt, exec() the page setup dialog
|
---|
111 | would create a sheet by default if the dialog was given a parent.
|
---|
112 | This is no longer supported in Qt 4.5. If you want to use sheets, use
|
---|
113 | QPageSetupDialog::open() instead.
|
---|
114 |
|
---|
115 | \omitvalue None
|
---|
116 | \omitvalue OwnsPrinter
|
---|
117 | */
|
---|
118 |
|
---|
119 | /*!
|
---|
120 | Sets the given \a option to be enabled if \a on is true;
|
---|
121 | otherwise, clears the given \a option.
|
---|
122 |
|
---|
123 | \sa options, testOption()
|
---|
124 | */
|
---|
125 | void QPageSetupDialog::setOption(PageSetupDialogOption option, bool on)
|
---|
126 | {
|
---|
127 | Q_D(QPageSetupDialog);
|
---|
128 | if (!(d->opts & option) != !on)
|
---|
129 | setOptions(d->opts ^ option);
|
---|
130 | }
|
---|
131 |
|
---|
132 | /*!
|
---|
133 | Returns true if the given \a option is enabled; otherwise, returns
|
---|
134 | false.
|
---|
135 |
|
---|
136 | \sa options, setOption()
|
---|
137 | */
|
---|
138 | bool QPageSetupDialog::testOption(PageSetupDialogOption option) const
|
---|
139 | {
|
---|
140 | Q_D(const QPageSetupDialog);
|
---|
141 | return (d->opts & option) != 0;
|
---|
142 | }
|
---|
143 |
|
---|
144 | /*!
|
---|
145 | \property QPageSetupDialog::options
|
---|
146 | \brief the various options that affect the look and feel of the dialog
|
---|
147 | \since 4.5
|
---|
148 |
|
---|
149 | By default, all options are disabled.
|
---|
150 |
|
---|
151 | Options should be set before showing the dialog. Setting them while the
|
---|
152 | dialog is visible is not guaranteed to have an immediate effect on the
|
---|
153 | dialog (depending on the option and on the platform).
|
---|
154 |
|
---|
155 | \sa setOption(), testOption()
|
---|
156 | */
|
---|
157 | void QPageSetupDialog::setOptions(PageSetupDialogOptions options)
|
---|
158 | {
|
---|
159 | Q_D(QPageSetupDialog);
|
---|
160 |
|
---|
161 | PageSetupDialogOptions changed = (options ^ d->opts);
|
---|
162 | if (!changed)
|
---|
163 | return;
|
---|
164 |
|
---|
165 | d->opts = options;
|
---|
166 | }
|
---|
167 |
|
---|
168 | QPageSetupDialog::PageSetupDialogOptions QPageSetupDialog::options() const
|
---|
169 | {
|
---|
170 | Q_D(const QPageSetupDialog);
|
---|
171 | return d->opts;
|
---|
172 | }
|
---|
173 |
|
---|
174 | /*!
|
---|
175 | \obsolete
|
---|
176 |
|
---|
177 | Use setOption(\a option, true) instead.
|
---|
178 | */
|
---|
179 | void QPageSetupDialog::addEnabledOption(PageSetupDialogOption option)
|
---|
180 | {
|
---|
181 | setOption(option, true);
|
---|
182 | }
|
---|
183 |
|
---|
184 | /*!
|
---|
185 | \obsolete
|
---|
186 |
|
---|
187 | Use setOptions(\a options) instead.
|
---|
188 | */
|
---|
189 | void QPageSetupDialog::setEnabledOptions(PageSetupDialogOptions options)
|
---|
190 | {
|
---|
191 | setOptions(options);
|
---|
192 | }
|
---|
193 |
|
---|
194 | /*!
|
---|
195 | \obsolete
|
---|
196 |
|
---|
197 | Use options() instead.
|
---|
198 | */
|
---|
199 | QPageSetupDialog::PageSetupDialogOptions QPageSetupDialog::enabledOptions() const
|
---|
200 | {
|
---|
201 | return options();
|
---|
202 | }
|
---|
203 |
|
---|
204 | /*!
|
---|
205 | \obsolete
|
---|
206 |
|
---|
207 | Use testOption(\a option) instead.
|
---|
208 | */
|
---|
209 | bool QPageSetupDialog::isOptionEnabled(PageSetupDialogOption option) const
|
---|
210 | {
|
---|
211 | return testOption(option);
|
---|
212 | }
|
---|
213 |
|
---|
214 | /*!
|
---|
215 | \overload
|
---|
216 | \since 4.5
|
---|
217 |
|
---|
218 | Opens the dialog and connects its accepted() signal to the slot specified
|
---|
219 | by \a receiver and \a member.
|
---|
220 |
|
---|
221 | The signal will be disconnected from the slot when the dialog is closed.
|
---|
222 | */
|
---|
223 | void QPageSetupDialog::open(QObject *receiver, const char *member)
|
---|
224 | {
|
---|
225 | Q_D(QPageSetupDialog);
|
---|
226 | connect(this, SIGNAL(accepted()), receiver, member);
|
---|
227 | d->receiverToDisconnectOnClose = receiver;
|
---|
228 | d->memberToDisconnectOnClose = member;
|
---|
229 | QDialog::open();
|
---|
230 | }
|
---|
231 |
|
---|
232 | #if defined(Q_WS_MAC) || defined(Q_OS_WIN)
|
---|
233 | /*! \fn void QPageSetupDialog::setVisible(bool visible)
|
---|
234 | \reimp
|
---|
235 | */
|
---|
236 | #endif
|
---|
237 |
|
---|
238 | QT_END_NAMESPACE
|
---|
239 |
|
---|
240 | #endif
|
---|