qpagesetupdialog.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/dialogs/qpagesetupdialog.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qpagesetupdialog.h"-
41#include <private/qpagesetupdialog_p.h>-
42-
43#include <QtPrintSupport/qprinter.h>-
44-
45#ifndef QT_NO_PRINTDIALOG-
46-
47QT_BEGIN_NAMESPACE-
48-
49/*!-
50 \class QPageSetupDialog-
51-
52 \brief The QPageSetupDialog class provides a configuration dialog-
53 for the page-related options on a printer.-
54-
55 \ingroup standard-dialogs-
56 \ingroup printing-
57 \inmodule QtPrintSupport-
58-
59 On Windows and \macos the page setup dialog is implemented using-
60 the native page setup dialogs.-
61-
62 Note that on Windows and \macos custom paper sizes won't be-
63 reflected in the native page setup dialogs. Additionally, custom-
64 page margins set on a QPrinter won't show in the native \macos-
65 page setup dialog.-
66-
67 \sa QPrinter, QPrintDialog-
68*/-
69-
70-
71/*!-
72 \fn QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent)-
73-
74 Constructs a page setup dialog that configures \a printer with \a-
75 parent as the parent widget.-
76*/-
77-
78/*!-
79 \fn QPageSetupDialog::~QPageSetupDialog()-
80-
81 Destroys the page setup dialog.-
82*/-
83-
84/*!-
85 \since 4.5-
86-
87 \fn QPageSetupDialog::QPageSetupDialog(QWidget *parent)-
88-
89 Constructs a page setup dialog that configures a default-constructed-
90 QPrinter with \a parent as the parent widget.-
91-
92 \sa printer()-
93*/-
94-
95/*!-
96 \fn QPrinter *QPageSetupDialog::printer()-
97-
98 Returns the printer that was passed to the QPageSetupDialog-
99 constructor.-
100*/-
101-
102QPageSetupDialogPrivate::QPageSetupDialogPrivate(QPrinter *prntr) : printer(0), ownsPrinter(false)-
103{-
104 setPrinter(prntr);-
105}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
106-
107void QPageSetupDialogPrivate::setPrinter(QPrinter *newPrinter)-
108{-
109 if (printer && ownsPrinter)
printerDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
ownsPrinterDescription
TRUEnever evaluated
FALSEnever evaluated
0-1
110 delete printer;
never executed: delete printer;
0
111-
112 if (newPrinter) {
newPrinterDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
0-1
113 printer = newPrinter;-
114 ownsPrinter = false;-
115 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
116 printer = new QPrinter;-
117 ownsPrinter = true;-
118 }
never executed: end of block
0
119#ifndef Q_DEAD_CODE_FROM_QT4_X11-
120 if (printer->outputFormat() != QPrinter::NativeFormat)
printer->outpu...::NativeFormatDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
0-1
121 qWarning("QPageSetupDialog: Cannot be used on non-native printers");
executed 1 time by 1 test: QMessageLogger(__FILE__, 121, __PRETTY_FUNCTION__).warning("QPageSetupDialog: Cannot be used on non-native printers");
Executed by:
  • tst_QPrinter
1
122#endif-
123}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
124-
125/*!-
126 \overload-
127 \since 4.5-
128-
129 Opens the dialog and connects its accepted() signal to the slot specified-
130 by \a receiver and \a member.-
131-
132 The signal will be disconnected from the slot when the dialog is closed.-
133*/-
134void QPageSetupDialog::open(QObject *receiver, const char *member)-
135{-
136 Q_D(QPageSetupDialog);-
137 connect(this, SIGNAL(accepted()), receiver, member);-
138 d->receiverToDisconnectOnClose = receiver;-
139 d->memberToDisconnectOnClose = member;-
140 QDialog::open();-
141}
never executed: end of block
0
142-
143#if defined(Q_OS_MAC) || defined(Q_OS_WIN)-
144/*! \fn void QPageSetupDialog::setVisible(bool visible)-
145 \reimp-
146*/-
147#endif-
148-
149QPageSetupDialog::~QPageSetupDialog()-
150{-
151 Q_D(QPageSetupDialog);-
152 if (d->ownsPrinter)
d->ownsPrinterDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
0-1
153 delete d->printer;
never executed: delete d->printer;
0
154}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
155-
156QPrinter *QPageSetupDialog::printer()-
157{-
158 Q_D(QPageSetupDialog);-
159 return d->printer;
never executed: return d->printer;
0
160}-
161-
162/*!-
163 \fn int QPageSetupDialog::exec()-
164-
165 This virtual function is called to pop up the dialog. It must be-
166 reimplemented in subclasses.-
167*/-
168-
169/*!-
170 \reimp-
171*/-
172void QPageSetupDialog::done(int result)-
173{-
174 Q_D(QPageSetupDialog);-
175 QDialog::done(result);-
176 if (d->receiverToDisconnectOnClose) {
d->receiverToDisconnectOnCloseDescription
TRUEnever evaluated
FALSEnever evaluated
0
177 disconnect(this, SIGNAL(accepted()),-
178 d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);-
179 d->receiverToDisconnectOnClose = 0;-
180 }
never executed: end of block
0
181 d->memberToDisconnectOnClose.clear();-
182-
183}
never executed: end of block
0
184-
185QT_END_NAMESPACE-
186-
187#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9