source: trunk/src/gui/dialogs/qpagesetupdialog.cpp@ 561

Last change on this file since 561 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 6.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 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
46QT_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 \sa QPrinter, QPrintDialog
66*/
67
68
69/*!
70 \fn QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent)
71
72 Constructs a page setup dialog that configures \a printer with \a
73 parent as the parent widget.
74*/
75
76/*!
77 \since 4.5
78
79 \fn QPageSetupDialog::QPageSetupDialog(QWidget *parent)
80
81 Constructs a page setup dialog that configures a default-constructed
82 QPrinter with \a parent as the parent widget.
83
84 \sa printer()
85*/
86
87/*!
88 \fn QPrinter *QPageSetupDialog::printer()
89
90 Returns the printer that was passed to the QPageSetupDialog
91 constructor.
92*/
93
94// hack
95class QPageSetupDialogPrivate : public QAbstractPageSetupDialogPrivate
96{
97};
98
99/*!
100 \enum QPageSetupDialog::PageSetupDialogOption
101 \since 4.4
102
103 Used to specify options to the page setup dialog
104
105 This value is obsolete and does nothing since Qt 4.5:
106
107 \value DontUseSheet In previous versions of Qt, exec() the page setup dialog
108 would create a sheet by default if the dialog was given a parent.
109 This is no longer supported in Qt 4.5. If you want to use sheets, use
110 QPageSetupDialog::open() instead.
111
112 \omitvalue None
113 \omitvalue OwnsPrinter
114*/
115
116/*!
117 Sets the given \a option to be enabled if \a on is true;
118 otherwise, clears the given \a option.
119
120 \sa options, testOption()
121*/
122void QPageSetupDialog::setOption(PageSetupDialogOption option, bool on)
123{
124 Q_D(QPageSetupDialog);
125 if (!(d->opts & option) != !on)
126 setOptions(d->opts ^ option);
127}
128
129/*!
130 Returns true if the given \a option is enabled; otherwise, returns
131 false.
132
133 \sa options, setOption()
134*/
135bool QPageSetupDialog::testOption(PageSetupDialogOption option) const
136{
137 Q_D(const QPageSetupDialog);
138 return (d->opts & option) != 0;
139}
140
141/*!
142 \property QPageSetupDialog::options
143 \brief the various options that affect the look and feel of the dialog
144 \since 4.5
145
146 By default, all options are disabled.
147
148 Options should be set before showing the dialog. Setting them while the
149 dialog is visible is not guaranteed to have an immediate effect on the
150 dialog (depending on the option and on the platform).
151
152 \sa setOption(), testOption()
153*/
154void QPageSetupDialog::setOptions(PageSetupDialogOptions options)
155{
156 Q_D(QPageSetupDialog);
157
158 PageSetupDialogOptions changed = (options ^ d->opts);
159 if (!changed)