dialogs/qpagesetupdialog.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
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 Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qpagesetupdialog.h" -
43#include <private/qpagesetupdialog_p.h> -
44 -
45#include <QtPrintSupport/qprinter.h> -
46 -
47#ifndef QT_NO_PRINTDIALOG -
48 -
49QT_BEGIN_NAMESPACE -
50 -
51/*! -
52 \class QPageSetupDialog -
53 -
54 \brief The QPageSetupDialog class provides a configuration dialog -
55 for the page-related options on a printer. -
56 -
57 \ingroup standard-dialogs -
58 \ingroup printing -
59 \inmodule QtPrintSupport -
60 -
61 On Windows and Mac OS X the page setup dialog is implemented using -
62 the native page setup dialogs. -
63 -
64 Note that on Windows and Mac OS X custom paper sizes won't be -
65 reflected in the native page setup dialogs. Additionally, custom -
66 page margins set on a QPrinter won't show in the native Mac OS X -
67 page setup dialog. -
68 -
69 \sa QPrinter, QPrintDialog -
70*/ -
71 -
72 -
73/*! -
74 \fn QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent) -
75 -
76 Constructs a page setup dialog that configures \a printer with \a -
77 parent as the parent widget. -
78*/ -
79 -
80/*! -
81 \fn QPageSetupDialog::~QPageSetupDialog() -
82 -
83 Destroys the page setup dialog. -
84*/ -
85 -
86/*! -
87 \since 4.5 -
88 -
89 \fn QPageSetupDialog::QPageSetupDialog(QWidget *parent) -
90 -
91 Constructs a page setup dialog that configures a default-constructed -
92 QPrinter with \a parent as the parent widget. -
93 -
94 \sa printer() -
95*/ -
96 -
97/*! -
98 \fn QPrinter *QPageSetupDialog::printer() -
99 -
100 Returns the printer that was passed to the QPageSetupDialog -
101 constructor. -
102*/ -
103 -
104QPageSetupDialogPrivate::QPageSetupDialogPrivate(QPrinter *prntr) : printer(0), ownsPrinter(false) -
105{ -
106 setPrinter(prntr);
executed (the execution status of this line is deduced): setPrinter(prntr);
-
107 init();
executed (the execution status of this line is deduced): init();
-
108}
executed: }
Execution Count:1
1
109 -
110void QPageSetupDialogPrivate::init() -
111{ -
112} -
113 -
114void QPageSetupDialogPrivate::setPrinter(QPrinter *newPrinter) -
115{ -
116 if (printer && ownsPrinter)
partially evaluated: printer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: ownsPrinter
0-1
117 delete printer;
never executed: delete printer;
0
118 -
119 if (newPrinter) {
partially evaluated: newPrinter
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
120 printer = newPrinter;
executed (the execution status of this line is deduced): printer = newPrinter;
-
121 ownsPrinter = false;
executed (the execution status of this line is deduced): ownsPrinter = false;
-
122 } else {
executed: }
Execution Count:1
1
123 printer = new QPrinter;
never executed (the execution status of this line is deduced): printer = new QPrinter;
-
124 ownsPrinter = true;
never executed (the execution status of this line is deduced): ownsPrinter = true;
-
125 }
never executed: }
0
126#ifndef Q_WS_X11 -
127 if (printer->outputFormat() != QPrinter::NativeFormat)
partially evaluated: printer->outputFormat() != QPrinter::NativeFormat
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
128 qWarning("QPageSetupDialog: Cannot be used on non-native printers");
executed: QMessageLogger("dialogs/qpagesetupdialog.cpp", 128, __PRETTY_FUNCTION__).warning("QPageSetupDialog: Cannot be used on non-native printers");
Execution Count:1
1
129#endif -
130}
executed: }
Execution Count:1
1
131 -
132/*! -
133 \overload -
134 \since 4.5 -
135 -
136 Opens the dialog and connects its accepted() signal to the slot specified -
137 by \a receiver and \a member. -
138 -
139 The signal will be disconnected from the slot when the dialog is closed. -
140*/ -
141void QPageSetupDialog::open(QObject *receiver, const char *member) -
142{ -
143 Q_D(QPageSetupDialog);
never executed (the execution status of this line is deduced): QPageSetupDialogPrivate * const d = d_func();
-
144 connect(this, SIGNAL(accepted()), receiver, member);
never executed (the execution status of this line is deduced): connect(this, "2""accepted()", receiver, member);
-
145 d->receiverToDisconnectOnClose = receiver;
never executed (the execution status of this line is deduced): d->receiverToDisconnectOnClose = receiver;
-
146 d->memberToDisconnectOnClose = member;
never executed (the execution status of this line is deduced): d->memberToDisconnectOnClose = member;
-
147 QDialog::open();
never executed (the execution status of this line is deduced): QDialog::open();
-
148}
never executed: }
0
149 -
150#if defined(Q_OS_MAC) || defined(Q_OS_WIN) -
151/*! \fn void QPageSetupDialog::setVisible(bool visible) -
152 \reimp -
153*/ -
154#endif -
155 -
156QPageSetupDialog::~QPageSetupDialog() -
157{ -
158 Q_D(QPageSetupDialog);
executed (the execution status of this line is deduced): QPageSetupDialogPrivate * const d = d_func();
-
159 if (d->ownsPrinter)
partially evaluated: d->ownsPrinter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
160 delete d->printer;
never executed: delete d->printer;
0
161}
executed: }
Execution Count:1
1
162 -
163QPrinter *QPageSetupDialog::printer() -
164{ -
165 Q_D(QPageSetupDialog);
never executed (the execution status of this line is deduced): QPageSetupDialogPrivate * const d = d_func();
-
166 return d->printer;
never executed: return d->printer;
0
167} -
168 -
169/*! -
170 \fn int QPageSetupDialog::exec() -
171 -
172 This virtual function is called to pop up the dialog. It must be -
173 reimplemented in subclasses. -
174*/ -
175 -
176/*! -
177 \reimp -
178*/ -
179void QPageSetupDialog::done(int result) -
180{ -
181 Q_D(QPageSetupDialog);
never executed (the execution status of this line is deduced): QPageSetupDialogPrivate * const d = d_func();
-
182 QDialog::done(result);
never executed (the execution status of this line is deduced): QDialog::done(result);
-
183 if (d->receiverToDisconnectOnClose) {
never evaluated: d->receiverToDisconnectOnClose
0
184 disconnect(this, SIGNAL(accepted()),
never executed (the execution status of this line is deduced): disconnect(this, "2""accepted()",
-
185 d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
never executed (the execution status of this line is deduced): d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
-
186 d->receiverToDisconnectOnClose = 0;
never executed (the execution status of this line is deduced): d->receiverToDisconnectOnClose = 0;
-
187 }
never executed: }
0
188 d->memberToDisconnectOnClose.clear();
never executed (the execution status of this line is deduced): d->memberToDisconnectOnClose.clear();
-
189 -
190}
never executed: }
0
191 -
192QT_END_NAMESPACE -
193 -
194#endif -
195 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial