Line | Source Code | Coverage |
---|
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 | | - |
44 | #ifndef QT_NO_PRINTDIALOG | - |
45 | #include "qpagesetupdialog_unix_p.h" | - |
46 | | - |
47 | #include "qpainter.h" | - |
48 | #include "qprintdialog.h" | - |
49 | #include "qdialogbuttonbox.h" | - |
50 | #include <ui_qpagesetupwidget.h> | - |
51 | | - |
52 | #include <QtPrintSupport/qprinter.h> | - |
53 | #include <private/qpagesetupdialog_p.h> | - |
54 | #include <private/qprinter_p.h> | - |
55 | #include <private/qprintengine_pdf_p.h> | - |
56 | | - |
57 | #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) | - |
58 | # include <private/qcups_p.h> | - |
59 | #endif | - |
60 | | - |
61 | QT_BEGIN_NAMESPACE | - |
62 | | - |
63 | QSizeF qt_printerPaperSize(QPrinter::Orientation, QPrinter::PaperSize, QPrinter::Unit, int); | - |
64 | | - |
65 | // Disabled until we have support for papersources on unix | - |
66 | // #define PSD_ENABLE_PAPERSOURCE | - |
67 | | - |
68 | static void populatePaperSizes(QComboBox* cb) | - |
69 | { | - |
70 | cb->addItem(QPrintDialog::tr("A0"), QPrinter::A0); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A0"), QPrinter::A0); | - |
71 | cb->addItem(QPrintDialog::tr("A1"), QPrinter::A1); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A1"), QPrinter::A1); | - |
72 | cb->addItem(QPrintDialog::tr("A2"), QPrinter::A2); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A2"), QPrinter::A2); | - |
73 | cb->addItem(QPrintDialog::tr("A3"), QPrinter::A3); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A3"), QPrinter::A3); | - |
74 | cb->addItem(QPrintDialog::tr("A4"), QPrinter::A4); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A4"), QPrinter::A4); | - |
75 | cb->addItem(QPrintDialog::tr("A5"), QPrinter::A5); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A5"), QPrinter::A5); | - |
76 | cb->addItem(QPrintDialog::tr("A6"), QPrinter::A6); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A6"), QPrinter::A6); | - |
77 | cb->addItem(QPrintDialog::tr("A7"), QPrinter::A7); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A7"), QPrinter::A7); | - |
78 | cb->addItem(QPrintDialog::tr("A8"), QPrinter::A8); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A8"), QPrinter::A8); | - |
79 | cb->addItem(QPrintDialog::tr("A9"), QPrinter::A9); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("A9"), QPrinter::A9); | - |
80 | cb->addItem(QPrintDialog::tr("B0"), QPrinter::B0); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B0"), QPrinter::B0); | - |
81 | cb->addItem(QPrintDialog::tr("B1"), QPrinter::B1); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B1"), QPrinter::B1); | - |
82 | cb->addItem(QPrintDialog::tr("B2"), QPrinter::B2); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B2"), QPrinter::B2); | - |
83 | cb->addItem(QPrintDialog::tr("B3"), QPrinter::B3); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B3"), QPrinter::B3); | - |
84 | cb->addItem(QPrintDialog::tr("B4"), QPrinter::B4); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B4"), QPrinter::B4); | - |
85 | cb->addItem(QPrintDialog::tr("B5"), QPrinter::B5); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B5"), QPrinter::B5); | - |
86 | cb->addItem(QPrintDialog::tr("B6"), QPrinter::B6); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B6"), QPrinter::B6); | - |
87 | cb->addItem(QPrintDialog::tr("B7"), QPrinter::B7); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B7"), QPrinter::B7); | - |
88 | cb->addItem(QPrintDialog::tr("B8"), QPrinter::B8); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B8"), QPrinter::B8); | - |
89 | cb->addItem(QPrintDialog::tr("B9"), QPrinter::B9); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B9"), QPrinter::B9); | - |
90 | cb->addItem(QPrintDialog::tr("B10"), QPrinter::B10); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("B10"), QPrinter::B10); | - |
91 | cb->addItem(QPrintDialog::tr("C5E"), QPrinter::C5E); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("C5E"), QPrinter::C5E); | - |
92 | cb->addItem(QPrintDialog::tr("DLE"), QPrinter::DLE); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("DLE"), QPrinter::DLE); | - |
93 | cb->addItem(QPrintDialog::tr("Executive"), QPrinter::Executive); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("Executive"), QPrinter::Executive); | - |
94 | cb->addItem(QPrintDialog::tr("Folio"), QPrinter::Folio); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("Folio"), QPrinter::Folio); | - |
95 | cb->addItem(QPrintDialog::tr("Ledger"), QPrinter::Ledger); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("Ledger"), QPrinter::Ledger); | - |
96 | cb->addItem(QPrintDialog::tr("Legal"), QPrinter::Legal); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("Legal"), QPrinter::Legal); | - |
97 | cb->addItem(QPrintDialog::tr("Letter"), QPrinter::Letter); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("Letter"), QPrinter::Letter); | - |
98 | cb->addItem(QPrintDialog::tr("Tabloid"), QPrinter::Tabloid); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("Tabloid"), QPrinter::Tabloid); | - |
99 | cb->addItem(QPrintDialog::tr("US Common #10 Envelope"), QPrinter::Comm10E); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("US Common #10 Envelope"), QPrinter::Comm10E); | - |
100 | cb->addItem(QPrintDialog::tr("Custom"), QPrinter::Custom); never executed (the execution status of this line is deduced): cb->addItem(QPrintDialog::tr("Custom"), QPrinter::Custom); | - |
101 | } | 0 |
102 | | - |
103 | | - |
104 | static QSizeF sizeForOrientation(QPrinter::Orientation orientation, const QSizeF &size) | - |
105 | { | - |
106 | return (orientation == QPrinter::Portrait) ? size : QSizeF(size.height(), size.width()); never executed: return (orientation == QPrinter::Portrait) ? size : QSizeF(size.height(), size.width()); | 0 |
107 | } | - |
108 | | - |
109 | #ifdef PSD_ENABLE_PAPERSOURCE | - |
110 | static const char *paperSourceNames[] = { | - |
111 | "Only One", | - |
112 | "Lower", | - |
113 | "Middle", | - |
114 | "Manual", | - |
115 | "Envelope", | - |
116 | "Envelope manual", | - |
117 | "Auto", | - |
118 | "Tractor", | - |
119 | "Small format", | - |
120 | "Large format", | - |
121 | "Large capacity", | - |
122 | "Cassette", | - |
123 | "Form source", | - |
124 | 0 | - |
125 | }; | - |
126 | | - |
127 | struct PaperSourceNames | - |
128 | { | - |
129 | PaperSourceNames(const char *nam, QPrinter::PaperSource ps) | - |
130 | : paperSource(ps), name(nam) {} | - |
131 | QPrinter::PaperSource paperSource; | - |
132 | const char *name; | - |
133 | }; | - |
134 | #endif | - |
135 | | - |
136 | | - |
137 | class QPagePreview : public QWidget | - |
138 | { | - |
139 | public: | - |
140 | QPagePreview(QWidget *parent) : QWidget(parent) | - |
141 | { | - |
142 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); never executed (the execution status of this line is deduced): setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | - |
143 | setMinimumSize(50, 50); never executed (the execution status of this line is deduced): setMinimumSize(50, 50); | - |
144 | } | 0 |
145 | | - |
146 | void setPaperSize(const QSizeF& size) | - |
147 | { | - |
148 | m_size = size; never executed (the execution status of this line is deduced): m_size = size; | - |
149 | update(); never executed (the execution status of this line is deduced): update(); | - |
150 | } | 0 |
151 | | - |
152 | void setMargins(qreal left, qreal top, qreal right, qreal bottom) | - |
153 | { | - |
154 | m_left = left; never executed (the execution status of this line is deduced): m_left = left; | - |
155 | m_top = top; never executed (the execution status of this line is deduced): m_top = top; | - |
156 | m_right = right; never executed (the execution status of this line is deduced): m_right = right; | - |
157 | m_bottom = bottom; never executed (the execution status of this line is deduced): m_bottom = bottom; | - |
158 | update(); never executed (the execution status of this line is deduced): update(); | - |
159 | } | 0 |
160 | | - |
161 | protected: | - |
162 | void paintEvent(QPaintEvent *) | - |
163 | { | - |
164 | QRect pageRect; never executed (the execution status of this line is deduced): QRect pageRect; | - |
165 | QSizeF adjustedSize(m_size); never executed (the execution status of this line is deduced): QSizeF adjustedSize(m_size); | - |
166 | adjustedSize.scale(width()-10, height()-10, Qt::KeepAspectRatio); never executed (the execution status of this line is deduced): adjustedSize.scale(width()-10, height()-10, Qt::KeepAspectRatio); | - |
167 | pageRect = QRect(QPoint(0,0), adjustedSize.toSize()); never executed (the execution status of this line is deduced): pageRect = QRect(QPoint(0,0), adjustedSize.toSize()); | - |
168 | pageRect.moveCenter(rect().center()); never executed (the execution status of this line is deduced): pageRect.moveCenter(rect().center()); | - |
169 | | - |
170 | qreal width_factor = pageRect.width() / m_size.width(); never executed (the execution status of this line is deduced): qreal width_factor = pageRect.width() / m_size.width(); | - |
171 | qreal height_factor = pageRect.height() / m_size.height(); never executed (the execution status of this line is deduced): qreal height_factor = pageRect.height() / m_size.height(); | - |
172 | int leftSize = qRound(m_left*width_factor); never executed (the execution status of this line is deduced): int leftSize = qRound(m_left*width_factor); | - |
173 | int topSize = qRound(m_top*height_factor); never executed (the execution status of this line is deduced): int topSize = qRound(m_top*height_factor); | - |
174 | int rightSize = qRound(m_right*width_factor); never executed (the execution status of this line is deduced): int rightSize = qRound(m_right*width_factor); | - |
175 | int bottomSize = qRound(m_bottom * height_factor); never executed (the execution status of this line is deduced): int bottomSize = qRound(m_bottom * height_factor); | - |
176 | QRect marginRect(pageRect.x()+leftSize, never executed (the execution status of this line is deduced): QRect marginRect(pageRect.x()+leftSize, | - |
177 | pageRect.y()+topSize, never executed (the execution status of this line is deduced): pageRect.y()+topSize, | - |
178 | pageRect.width() - (leftSize+rightSize+1), never executed (the execution status of this line is deduced): pageRect.width() - (leftSize+rightSize+1), | - |
179 | pageRect.height() - (topSize+bottomSize+1)); never executed (the execution status of this line is deduced): pageRect.height() - (topSize+bottomSize+1)); | - |
180 | | - |
181 | QPainter p(this); never executed (the execution status of this line is deduced): QPainter p(this); | - |
182 | QColor shadow(palette().mid().color()); never executed (the execution status of this line is deduced): QColor shadow(palette().mid().color()); | - |
183 | for (int i=1; i<6; ++i) { | 0 |
184 | shadow.setAlpha(180-i*30); never executed (the execution status of this line is deduced): shadow.setAlpha(180-i*30); | - |
185 | QRect offset(pageRect.adjusted(i, i, i, i)); never executed (the execution status of this line is deduced): QRect offset(pageRect.adjusted(i, i, i, i)); | - |
186 | p.setPen(shadow); never executed (the execution status of this line is deduced): p.setPen(shadow); | - |
187 | p.drawLine(offset.left(), offset.bottom(), offset.right(), offset.bottom()); never executed (the execution status of this line is deduced): p.drawLine(offset.left(), offset.bottom(), offset.right(), offset.bottom()); | - |
188 | p.drawLine(offset.right(), offset.top(), offset.right(), offset.bottom()-1); never executed (the execution status of this line is deduced): p.drawLine(offset.right(), offset.top(), offset.right(), offset.bottom()-1); | - |
189 | } | 0 |
190 | p.fillRect(pageRect, palette().light()); never executed (the execution status of this line is deduced): p.fillRect(pageRect, palette().light()); | - |
191 | | - |
192 | if (marginRect.isValid()) { never evaluated: marginRect.isValid() | 0 |
193 | p.setPen(QPen(palette().color(QPalette::Dark), 0, Qt::DotLine)); never executed (the execution status of this line is deduced): p.setPen(QPen(palette().color(QPalette::Dark), 0, Qt::DotLine)); | - |
194 | p.drawRect(marginRect); never executed (the execution status of this line is deduced): p.drawRect(marginRect); | - |
195 | | - |
196 | marginRect.adjust(2, 2, -1, -1); never executed (the execution status of this line is deduced): marginRect.adjust(2, 2, -1, -1); | - |
197 | p.setClipRect(marginRect); never executed (the execution status of this line is deduced): p.setClipRect(marginRect); | - |
198 | QFont font; never executed (the execution status of this line is deduced): QFont font; | - |
199 | font.setPointSizeF(font.pointSizeF()*0.25); never executed (the execution status of this line is deduced): font.setPointSizeF(font.pointSizeF()*0.25); | - |
200 | p.setFont(font); never executed (the execution status of this line is deduced): p.setFont(font); | - |
201 | p.setPen(palette().color(QPalette::Dark)); never executed (the execution status of this line is deduced): p.setPen(palette().color(QPalette::Dark)); | - |
202 | QString text(QLatin1String("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.")); never executed (the execution status of this line is deduced): QString text(QLatin1String("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.")); | - |
203 | for (int i=0; i<3; ++i) | 0 |
204 | text += text; never executed: text += text; | 0 |
205 | p.drawText(marginRect, Qt::TextWordWrap|Qt::AlignVCenter, text); never executed (the execution status of this line is deduced): p.drawText(marginRect, Qt::TextWordWrap|Qt::AlignVCenter, text); | - |
206 | } | 0 |
207 | } | 0 |
208 | | - |
209 | private: | - |
210 | // all these are in points | - |
211 | qreal m_left, m_top, m_right, m_bottom; | - |
212 | QSizeF m_size; | - |
213 | }; | - |
214 | | - |
215 | | - |
216 | class QUnixPageSetupDialogPrivate : public QPageSetupDialogPrivate | - |
217 | { | - |
218 | Q_DECLARE_PUBLIC(QPageSetupDialog) | - |
219 | | - |
220 | public: | - |
221 | QUnixPageSetupDialogPrivate(QPrinter *printer); | - |
222 | ~QUnixPageSetupDialogPrivate(); | - |
223 | void init(); | - |
224 | | - |
225 | QPageSetupWidget *widget; | - |
226 | }; | - |
227 | | - |
228 | QUnixPageSetupDialogPrivate::QUnixPageSetupDialogPrivate(QPrinter *printer) : QPageSetupDialogPrivate(printer) | - |
229 | { | - |
230 | } executed: } Execution Count:1 | 1 |
231 | | - |
232 | QUnixPageSetupDialogPrivate::~QUnixPageSetupDialogPrivate() | - |
233 | { | - |
234 | } | - |
235 | | - |
236 | void QUnixPageSetupDialogPrivate::init() | - |
237 | { | - |
238 | Q_Q(QPageSetupDialog); never executed (the execution status of this line is deduced): QPageSetupDialog * const q = q_func(); | - |
239 | | - |
240 | widget = new QPageSetupWidget(q); never executed (the execution status of this line is deduced): widget = new QPageSetupWidget(q); | - |
241 | widget->setPrinter(printer); never executed (the execution status of this line is deduced): widget->setPrinter(printer); | - |
242 | | - |
243 | QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok never executed (the execution status of this line is deduced): QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | - |
244 | | QDialogButtonBox::Cancel, never executed (the execution status of this line is deduced): | QDialogButtonBox::Cancel, | - |
245 | Qt::Horizontal, q); never executed (the execution status of this line is deduced): Qt::Horizontal, q); | - |
246 | QObject::connect(buttons, SIGNAL(accepted()), q, SLOT(accept())); never executed (the execution status of this line is deduced): QObject::connect(buttons, "2""accepted()", q, "1""accept()"); | - |
247 | QObject::connect(buttons, SIGNAL(rejected()), q, SLOT(reject())); never executed (the execution status of this line is deduced): QObject::connect(buttons, "2""rejected()", q, "1""reject()"); | - |
248 | | - |
249 | QVBoxLayout *lay = new QVBoxLayout(q); never executed (the execution status of this line is deduced): QVBoxLayout *lay = new QVBoxLayout(q); | - |
250 | lay->addWidget(widget); never executed (the execution status of this line is deduced): lay->addWidget(widget); | - |
251 | lay->addWidget(buttons); never executed (the execution status of this line is deduced): lay->addWidget(buttons); | - |
252 | } | 0 |
253 | | - |
254 | QPageSetupWidget::QPageSetupWidget(QWidget *parent) | - |
255 | : QWidget(parent), | - |
256 | m_printer(0), | - |
257 | m_blockSignals(false), | - |
258 | m_cups(false) | - |
259 | { | - |
260 | widget.setupUi(this); never executed (the execution status of this line is deduced): widget.setupUi(this); | - |
261 | | - |
262 | QString suffix = (QLocale::system().measurementSystem() == QLocale::ImperialSystem) never evaluated: (QLocale::system().measurementSystem() == QLocale::ImperialSystem) | 0 |
263 | ? QString::fromLatin1(" in") never executed (the execution status of this line is deduced): ? QString::fromLatin1(" in") | - |
264 | : QString::fromLatin1(" mm"); never executed (the execution status of this line is deduced): : QString::fromLatin1(" mm"); | - |
265 | widget.topMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.topMargin->setSuffix(suffix); | - |
266 | widget.bottomMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.bottomMargin->setSuffix(suffix); | - |
267 | widget.leftMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.leftMargin->setSuffix(suffix); | - |
268 | widget.rightMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.rightMargin->setSuffix(suffix); | - |
269 | widget.paperWidth->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.paperWidth->setSuffix(suffix); | - |
270 | widget.paperHeight->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.paperHeight->setSuffix(suffix); | - |
271 | | - |
272 | QVBoxLayout *lay = new QVBoxLayout(widget.preview); never executed (the execution status of this line is deduced): QVBoxLayout *lay = new QVBoxLayout(widget.preview); | - |
273 | widget.preview->setLayout(lay); never executed (the execution status of this line is deduced): widget.preview->setLayout(lay); | - |
274 | m_pagePreview = new QPagePreview(widget.preview); never executed (the execution status of this line is deduced): m_pagePreview = new QPagePreview(widget.preview); | - |
275 | lay->addWidget(m_pagePreview); never executed (the execution status of this line is deduced): lay->addWidget(m_pagePreview); | - |
276 | | - |
277 | setAttribute(Qt::WA_WState_Polished, false); never executed (the execution status of this line is deduced): setAttribute(Qt::WA_WState_Polished, false); | - |
278 | | - |
279 | #ifdef PSD_ENABLE_PAPERSOURCE | - |
280 | for (int i=0; paperSourceNames[i]; ++i) | - |
281 | widget.paperSource->insertItem(paperSourceNames[i]); | - |
282 | #else | - |
283 | widget.paperSourceLabel->setVisible(false); never executed (the execution status of this line is deduced): widget.paperSourceLabel->setVisible(false); | - |
284 | widget.paperSource->setVisible(false); never executed (the execution status of this line is deduced): widget.paperSource->setVisible(false); | - |
285 | #endif | - |
286 | | - |
287 | widget.reverseLandscape->setVisible(false); never executed (the execution status of this line is deduced): widget.reverseLandscape->setVisible(false); | - |
288 | widget.reversePortrait->setVisible(false); never executed (the execution status of this line is deduced): widget.reversePortrait->setVisible(false); | - |
289 | | - |
290 | populatePaperSizes(widget.paperSize); never executed (the execution status of this line is deduced): populatePaperSizes(widget.paperSize); | - |
291 | | - |
292 | QStringList units; never executed (the execution status of this line is deduced): QStringList units; | - |
293 | units << tr("Centimeters (cm)") << tr("Millimeters (mm)") << tr("Inches (in)") << tr("Points (pt)"); never executed (the execution status of this line is deduced): units << tr("Centimeters (cm)") << tr("Millimeters (mm)") << tr("Inches (in)") << tr("Points (pt)"); | - |
294 | widget.unit->addItems(units); never executed (the execution status of this line is deduced): widget.unit->addItems(units); | - |
295 | connect(widget.unit, SIGNAL(activated(int)), this, SLOT(unitChanged(int))); never executed (the execution status of this line is deduced): connect(widget.unit, "2""activated(int)", this, "1""unitChanged(int)"); | - |
296 | widget.unit->setCurrentIndex((QLocale::system().measurementSystem() == QLocale::ImperialSystem) ? 2 : 1); never executed (the execution status of this line is deduced): widget.unit->setCurrentIndex((QLocale::system().measurementSystem() == QLocale::ImperialSystem) ? 2 : 1); | - |
297 | | - |
298 | connect(widget.paperSize, SIGNAL(currentIndexChanged(int)), this, SLOT(_q_paperSizeChanged())); never executed (the execution status of this line is deduced): connect(widget.paperSize, "2""currentIndexChanged(int)", this, "1""_q_paperSizeChanged()"); | - |
299 | connect(widget.paperWidth, SIGNAL(valueChanged(double)), this, SLOT(_q_paperSizeChanged())); never executed (the execution status of this line is deduced): connect(widget.paperWidth, "2""valueChanged(double)", this, "1""_q_paperSizeChanged()"); | - |
300 | connect(widget.paperHeight, SIGNAL(valueChanged(double)), this, SLOT(_q_paperSizeChanged())); never executed (the execution status of this line is deduced): connect(widget.paperHeight, "2""valueChanged(double)", this, "1""_q_paperSizeChanged()"); | - |
301 | | - |
302 | connect(widget.leftMargin, SIGNAL(valueChanged(double)), this, SLOT(setLeftMargin(double))); never executed (the execution status of this line is deduced): connect(widget.leftMargin, "2""valueChanged(double)", this, "1""setLeftMargin(double)"); | - |
303 | connect(widget.topMargin, SIGNAL(valueChanged(double)), this, SLOT(setTopMargin(double))); never executed (the execution status of this line is deduced): connect(widget.topMargin, "2""valueChanged(double)", this, "1""setTopMargin(double)"); | - |
304 | connect(widget.rightMargin, SIGNAL(valueChanged(double)), this, SLOT(setRightMargin(double))); never executed (the execution status of this line is deduced): connect(widget.rightMargin, "2""valueChanged(double)", this, "1""setRightMargin(double)"); | - |
305 | connect(widget.bottomMargin, SIGNAL(valueChanged(double)), this, SLOT(setBottomMargin(double))); never executed (the execution status of this line is deduced): connect(widget.bottomMargin, "2""valueChanged(double)", this, "1""setBottomMargin(double)"); | - |
306 | | - |
307 | connect(widget.portrait, SIGNAL(clicked()), this, SLOT(_q_pageOrientationChanged())); never executed (the execution status of this line is deduced): connect(widget.portrait, "2""clicked()", this, "1""_q_pageOrientationChanged()"); | - |
308 | connect(widget.landscape, SIGNAL(clicked()), this, SLOT(_q_pageOrientationChanged())); never executed (the execution status of this line is deduced): connect(widget.landscape, "2""clicked()", this, "1""_q_pageOrientationChanged()"); | - |
309 | } | 0 |
310 | | - |
311 | void QPageSetupWidget::setPrinter(QPrinter *printer) | - |
312 | { | - |
313 | m_printer = printer; never executed (the execution status of this line is deduced): m_printer = printer; | - |
314 | m_blockSignals = true; never executed (the execution status of this line is deduced): m_blockSignals = true; | - |
315 | selectPdfPsPrinter(printer); never executed (the execution status of this line is deduced): selectPdfPsPrinter(printer); | - |
316 | printer->getPageMargins(&m_leftMargin, &m_topMargin, &m_rightMargin, &m_bottomMargin, QPrinter::Point); never executed (the execution status of this line is deduced): printer->getPageMargins(&m_leftMargin, &m_topMargin, &m_rightMargin, &m_bottomMargin, QPrinter::Point); | - |
317 | unitChanged(widget.unit->currentIndex()); never executed (the execution status of this line is deduced): unitChanged(widget.unit->currentIndex()); | - |
318 | m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); never executed (the execution status of this line is deduced): m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); | - |
319 | m_paperSize = printer->paperSize(QPrinter::Point); never executed (the execution status of this line is deduced): m_paperSize = printer->paperSize(QPrinter::Point); | - |
320 | widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); | - |
321 | widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); | - |
322 | | - |
323 | widget.landscape->setChecked(printer->orientation() == QPrinter::Landscape); never executed (the execution status of this line is deduced): widget.landscape->setChecked(printer->orientation() == QPrinter::Landscape); | - |
324 | | - |
325 | #ifdef PSD_ENABLE_PAPERSOURCE | - |
326 | widget.paperSource->setCurrentItem(printer->paperSource()); | - |
327 | #endif | - |
328 | Q_ASSERT(m_blockSignals); never executed (the execution status of this line is deduced): qt_noop(); | - |
329 | m_blockSignals = false; never executed (the execution status of this line is deduced): m_blockSignals = false; | - |
330 | _q_paperSizeChanged(); never executed (the execution status of this line is deduced): _q_paperSizeChanged(); | - |
331 | } | 0 |
332 | | - |
333 | // set gui data on printer | - |
334 | void QPageSetupWidget::setupPrinter() const | - |
335 | { | - |
336 | QPrinter::Orientation orientation = widget.portrait->isChecked() never evaluated: widget.portrait->isChecked() | 0 |
337 | ? QPrinter::Portrait never executed (the execution status of this line is deduced): ? QPrinter::Portrait | - |
338 | : QPrinter::Landscape; never executed (the execution status of this line is deduced): : QPrinter::Landscape; | - |
339 | m_printer->setOrientation(orientation); never executed (the execution status of this line is deduced): m_printer->setOrientation(orientation); | - |
340 | // paper format | - |
341 | QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); never executed (the execution status of this line is deduced): QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); | - |
342 | int ps = m_printer->pageSize(); never executed (the execution status of this line is deduced): int ps = m_printer->pageSize(); | - |
343 | if (val.type() == QVariant::Int) { never evaluated: val.type() == QVariant::Int | 0 |
344 | ps = val.toInt(); never executed (the execution status of this line is deduced): ps = val.toInt(); | - |
345 | } | 0 |
346 | #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) | - |
347 | else if (val.type() == QVariant::ByteArray) { never evaluated: val.type() == QVariant::ByteArray | 0 |
348 | for (int papersize = 0; papersize < QPrinter::NPageSize; ++papersize) { never evaluated: papersize < QPrinter::NPageSize | 0 |
349 | QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(papersize)); never executed (the execution status of this line is deduced): QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(papersize)); | - |
350 | if (size.width == m_paperSize.width() && size.height == m_paperSize.height()) { never evaluated: size.width == m_paperSize.width() never evaluated: size.height == m_paperSize.height() | 0 |
351 | ps = static_cast<QPrinter::PaperSize>(papersize); never executed (the execution status of this line is deduced): ps = static_cast<QPrinter::PaperSize>(papersize); | - |
352 | break; | 0 |
353 | } | - |
354 | } | 0 |
355 | } | 0 |
356 | #endif | - |
357 | if (ps == QPrinter::Custom) { never evaluated: ps == QPrinter::Custom | 0 |
358 | m_printer->setPaperSize(sizeForOrientation(orientation, m_paperSize), QPrinter::Point); never executed (the execution status of this line is deduced): m_printer->setPaperSize(sizeForOrientation(orientation, m_paperSize), QPrinter::Point); | - |
359 | } | 0 |
360 | else { | - |
361 | m_printer->setPaperSize(static_cast<QPrinter::PaperSize>(ps)); never executed (the execution status of this line is deduced): m_printer->setPaperSize(static_cast<QPrinter::PaperSize>(ps)); | - |
362 | } | 0 |
363 | | - |
364 | #ifdef PSD_ENABLE_PAPERSOURCE | - |
365 | m_printer->setPaperSource((QPrinter::PaperSource)widget.paperSource->currentIndex()); | - |
366 | #endif | - |
367 | m_printer->setPageMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin, QPrinter::Point); never executed (the execution status of this line is deduced): m_printer->setPageMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin, QPrinter::Point); | - |
368 | | - |
369 | } | 0 |
370 | | - |
371 | void QPageSetupWidget::selectPrinter() | - |
372 | { | - |
373 | widget.paperSize->clear(); never executed (the execution status of this line is deduced): widget.paperSize->clear(); | - |
374 | #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) | - |
375 | if (QCUPSSupport::isAvailable()) { never evaluated: QCUPSSupport::isAvailable() | 0 |
376 | m_cups = true; never executed (the execution status of this line is deduced): m_cups = true; | - |
377 | QCUPSSupport cups; never executed (the execution status of this line is deduced): QCUPSSupport cups; | - |
378 | const ppd_option_t* pageSizes = cups.pageSizes(); never executed (the execution status of this line is deduced): const ppd_option_t* pageSizes = cups.pageSizes(); | - |
379 | const int numChoices = pageSizes ? pageSizes->num_choices : 0; never evaluated: pageSizes | 0 |
380 | | - |
381 | int cupsDefaultSize = 0; never executed (the execution status of this line is deduced): int cupsDefaultSize = 0; | - |
382 | QSize qtPreferredSize = m_printer->paperSize(QPrinter::Point).toSize(); never executed (the execution status of this line is deduced): QSize qtPreferredSize = m_printer->paperSize(QPrinter::Point).toSize(); | - |
383 | bool preferredSizeMatched = false; never executed (the execution status of this line is deduced): bool preferredSizeMatched = false; | - |
384 | for (int i = 0; i < numChoices; ++i) { never evaluated: i < numChoices | 0 |
385 | widget.paperSize->addItem(QString::fromLocal8Bit(pageSizes->choices[i].text), QByteArray(pageSizes->choices[i].choice)); never executed (the execution status of this line is deduced): widget.paperSize->addItem(QString::fromLocal8Bit(pageSizes->choices[i].text), QByteArray(pageSizes->choices[i].choice)); | - |
386 | if (static_cast<int>(pageSizes->choices[i].marked) == 1) never evaluated: static_cast<int>(pageSizes->choices[i].marked) == 1 | 0 |
387 | cupsDefaultSize = i; never executed: cupsDefaultSize = i; | 0 |
388 | QRect cupsPaperSize = cups.paperRect(pageSizes->choices[i].choice); never executed (the execution status of this line is deduced): QRect cupsPaperSize = cups.paperRect(pageSizes->choices[i].choice); | - |
389 | QSize diff = cupsPaperSize.size() - qtPreferredSize; never executed (the execution status of this line is deduced): QSize diff = cupsPaperSize.size() - qtPreferredSize; | - |
390 | if (qAbs(diff.width()) < 5 && qAbs(diff.height()) < 5) { never evaluated: qAbs(diff.width()) < 5 never evaluated: qAbs(diff.height()) < 5 | 0 |
391 | widget.paperSize->setCurrentIndex(i); never executed (the execution status of this line is deduced): widget.paperSize->setCurrentIndex(i); | - |
392 | preferredSizeMatched = true; never executed (the execution status of this line is deduced): preferredSizeMatched = true; | - |
393 | } | 0 |
394 | } | 0 |
395 | if (!preferredSizeMatched) never evaluated: !preferredSizeMatched | 0 |
396 | widget.paperSize->setCurrentIndex(cupsDefaultSize); never executed: widget.paperSize->setCurrentIndex(cupsDefaultSize); | 0 |
397 | if (m_printer->d_func()->hasCustomPageMargins) { never evaluated: m_printer->d_func()->hasCustomPageMargins | 0 |
398 | m_printer->getPageMargins(&m_leftMargin, &m_topMargin, &m_rightMargin, &m_bottomMargin, QPrinter::Point); never executed (the execution status of this line is deduced): m_printer->getPageMargins(&m_leftMargin, &m_topMargin, &m_rightMargin, &m_bottomMargin, QPrinter::Point); | - |
399 | } else { | 0 |
400 | QByteArray cupsPaperSizeChoice = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray(); never executed (the execution status of this line is deduced): QByteArray cupsPaperSizeChoice = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray(); | - |
401 | QRect paper = cups.paperRect(cupsPaperSizeChoice); never executed (the execution status of this line is deduced): QRect paper = cups.paperRect(cupsPaperSizeChoice); | - |
402 | QRect content = cups.pageRect(cupsPaperSizeChoice); never executed (the execution status of this line is deduced): QRect content = cups.pageRect(cupsPaperSizeChoice); | - |
403 | | - |
404 | m_leftMargin = content.x() - paper.x(); never executed (the execution status of this line is deduced): m_leftMargin = content.x() - paper.x(); | - |
405 | m_topMargin = content.y() - paper.y(); never executed (the execution status of this line is deduced): m_topMargin = content.y() - paper.y(); | - |
406 | m_rightMargin = paper.right() - content.right(); never executed (the execution status of this line is deduced): m_rightMargin = paper.right() - content.right(); | - |
407 | m_bottomMargin = paper.bottom() - content.bottom(); never executed (the execution status of this line is deduced): m_bottomMargin = paper.bottom() - content.bottom(); | - |
408 | } | 0 |
409 | } else | - |
410 | m_cups = false; never executed: m_cups = false; | 0 |
411 | #endif | - |
412 | if (widget.paperSize->count() == 0) { never evaluated: widget.paperSize->count() == 0 | 0 |
413 | populatePaperSizes(widget.paperSize); never executed (the execution status of this line is deduced): populatePaperSizes(widget.paperSize); | - |
414 | widget.paperSize->setCurrentIndex(widget.paperSize->findData( never executed (the execution status of this line is deduced): widget.paperSize->setCurrentIndex(widget.paperSize->findData( | - |
415 | QLocale::system().measurementSystem() == QLocale::ImperialSystem ? QPrinter::Letter : QPrinter::A4)); never executed (the execution status of this line is deduced): QLocale::system().measurementSystem() == QLocale::ImperialSystem ? QPrinter::Letter : QPrinter::A4)); | - |
416 | } | 0 |
417 | | - |
418 | unitChanged(widget.unit->currentIndex()); never executed (the execution status of this line is deduced): unitChanged(widget.unit->currentIndex()); | - |
419 | m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); never executed (the execution status of this line is deduced): m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); | - |
420 | | - |
421 | // setup printer here the first time | - |
422 | setupPrinter(); never executed (the execution status of this line is deduced): setupPrinter(); | - |
423 | } | 0 |
424 | | - |
425 | void QPageSetupWidget::selectPdfPsPrinter(const QPrinter *p) | - |
426 | { | - |
427 | m_cups = false; never executed (the execution status of this line is deduced): m_cups = false; | - |
428 | widget.paperSize->clear(); never executed (the execution status of this line is deduced): widget.paperSize->clear(); | - |
429 | populatePaperSizes(widget.paperSize); never executed (the execution status of this line is deduced): populatePaperSizes(widget.paperSize); | - |
430 | widget.paperSize->setCurrentIndex(widget.paperSize->findData(p->paperSize())); never executed (the execution status of this line is deduced): widget.paperSize->setCurrentIndex(widget.paperSize->findData(p->paperSize())); | - |
431 | unitChanged(widget.unit->currentIndex()); never executed (the execution status of this line is deduced): unitChanged(widget.unit->currentIndex()); | - |
432 | m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); never executed (the execution status of this line is deduced): m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); | - |
433 | } | 0 |
434 | | - |
435 | // Updates size/preview after the combobox has been changed. | - |
436 | void QPageSetupWidget::_q_paperSizeChanged() | - |
437 | { | - |
438 | QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); never executed (the execution status of this line is deduced): QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); | - |
439 | int index = m_printer->pageSize(); never executed (the execution status of this line is deduced): int index = m_printer->pageSize(); | - |
440 | if (val.type() == QVariant::Int) { never evaluated: val.type() == QVariant::Int | 0 |
441 | index = val.toInt(); never executed (the execution status of this line is deduced): index = val.toInt(); | - |
442 | } | 0 |
443 | | - |
444 | if (m_blockSignals) return; never executed: return; never evaluated: m_blockSignals | 0 |
445 | m_blockSignals = true; never executed (the execution status of this line is deduced): m_blockSignals = true; | - |
446 | | - |
447 | QPrinter::PaperSize size = QPrinter::PaperSize(index); never executed (the execution status of this line is deduced): QPrinter::PaperSize size = QPrinter::PaperSize(index); | - |
448 | QPrinter::Orientation orientation = widget.portrait->isChecked() never evaluated: widget.portrait->isChecked() | 0 |
449 | ? QPrinter::Portrait never executed (the execution status of this line is deduced): ? QPrinter::Portrait | - |
450 | : QPrinter::Landscape; never executed (the execution status of this line is deduced): : QPrinter::Landscape; | - |
451 | | - |
452 | bool custom = size == QPrinter::Custom; never executed (the execution status of this line is deduced): bool custom = size == QPrinter::Custom; | - |
453 | | - |
454 | #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) | - |
455 | custom = custom ? m_cups : custom; | 0 |
456 | #endif | - |
457 | | - |
458 | widget.paperWidth->setEnabled(custom); never executed (the execution status of this line is deduced): widget.paperWidth->setEnabled(custom); | - |
459 | widget.paperHeight->setEnabled(custom); never executed (the execution status of this line is deduced): widget.paperHeight->setEnabled(custom); | - |
460 | widget.widthLabel->setEnabled(custom); never executed (the execution status of this line is deduced): widget.widthLabel->setEnabled(custom); | - |
461 | widget.heightLabel->setEnabled(custom); never executed (the execution status of this line is deduced): widget.heightLabel->setEnabled(custom); | - |
462 | if (custom) { | 0 |
463 | m_paperSize.setWidth( widget.paperWidth->value() * m_currentMultiplier); never executed (the execution status of this line is deduced): m_paperSize.setWidth( widget.paperWidth->value() * m_currentMultiplier); | - |
464 | m_paperSize.setHeight( widget.paperHeight->value() * m_currentMultiplier); never executed (the execution status of this line is deduced): m_paperSize.setHeight( widget.paperHeight->value() * m_currentMultiplier); | - |
465 | m_pagePreview->setPaperSize(m_paperSize); never executed (the execution status of this line is deduced): m_pagePreview->setPaperSize(m_paperSize); | - |
466 | } else { | 0 |
467 | Q_ASSERT(m_printer); never executed (the execution status of this line is deduced): qt_noop(); | - |
468 | #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) | - |
469 | if (m_cups && QCUPSSupport::isAvailable()) { // combobox is filled with cups based data never evaluated: m_cups never evaluated: QCUPSSupport::isAvailable() | 0 |
470 | QCUPSSupport cups; never executed (the execution status of this line is deduced): QCUPSSupport cups; | - |
471 | QByteArray cupsPageSize = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray(); never executed (the execution status of this line is deduced): QByteArray cupsPageSize = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray(); | - |
472 | m_paperSize = cups.paperRect(cupsPageSize).size(); never executed (the execution status of this line is deduced): m_paperSize = cups.paperRect(cupsPageSize).size(); | - |
473 | if (orientation == QPrinter::Landscape) never evaluated: orientation == QPrinter::Landscape | 0 |
474 | m_paperSize = QSizeF(m_paperSize.height(), m_paperSize.width()); // swap never executed: m_paperSize = QSizeF(m_paperSize.height(), m_paperSize.width()); | 0 |
475 | } | 0 |
476 | else | - |
477 | #endif | - |
478 | m_paperSize = qt_printerPaperSize(orientation, size, QPrinter::Point, 1); never executed: m_paperSize = qt_printerPaperSize(orientation, size, QPrinter::Point, 1); | 0 |
479 | | - |
480 | m_pagePreview->setPaperSize(m_paperSize); never executed (the execution status of this line is deduced): m_pagePreview->setPaperSize(m_paperSize); | - |
481 | widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); | - |
482 | widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); | - |
483 | } | 0 |
484 | m_blockSignals = false; never executed (the execution status of this line is deduced): m_blockSignals = false; | - |
485 | } | 0 |
486 | | - |
487 | void QPageSetupWidget::_q_pageOrientationChanged() | - |
488 | { | - |
489 | if (QPrinter::PaperSize(widget.paperSize->currentIndex()) == QPrinter::Custom) { never evaluated: QPrinter::PaperSize(widget.paperSize->currentIndex()) == QPrinter::Custom | 0 |
490 | double tmp = widget.paperWidth->value(); never executed (the execution status of this line is deduced): double tmp = widget.paperWidth->value(); | - |
491 | widget.paperWidth->setValue(widget.paperHeight->value()); never executed (the execution status of this line is deduced): widget.paperWidth->setValue(widget.paperHeight->value()); | - |
492 | widget.paperHeight->setValue(tmp); never executed (the execution status of this line is deduced): widget.paperHeight->setValue(tmp); | - |
493 | } | 0 |
494 | _q_paperSizeChanged(); never executed (the execution status of this line is deduced): _q_paperSizeChanged(); | - |
495 | } | 0 |
496 | | - |
497 | extern double qt_multiplierForUnit(QPrinter::Unit unit, int resolution); | - |
498 | | - |
499 | void QPageSetupWidget::unitChanged(int item) | - |
500 | { | - |
501 | QString suffix; never executed (the execution status of this line is deduced): QString suffix; | - |
502 | switch(item) { | - |
503 | case 0: | - |
504 | m_currentMultiplier = 10 * qt_multiplierForUnit(QPrinter::Millimeter, 1); never executed (the execution status of this line is deduced): m_currentMultiplier = 10 * qt_multiplierForUnit(QPrinter::Millimeter, 1); | - |
505 | suffix = QString::fromLatin1(" cm"); never executed (the execution status of this line is deduced): suffix = QString::fromLatin1(" cm"); | - |
506 | break; | 0 |
507 | case 2: | - |
508 | m_currentMultiplier = qt_multiplierForUnit(QPrinter::Inch, 1); never executed (the execution status of this line is deduced): m_currentMultiplier = qt_multiplierForUnit(QPrinter::Inch, 1); | - |
509 | suffix = QString::fromLatin1(" in"); never executed (the execution status of this line is deduced): suffix = QString::fromLatin1(" in"); | - |
510 | break; | 0 |
511 | case 3: | - |
512 | m_currentMultiplier = qt_multiplierForUnit(QPrinter::Point, 1); never executed (the execution status of this line is deduced): m_currentMultiplier = qt_multiplierForUnit(QPrinter::Point, 1); | - |
513 | suffix = QString::fromLatin1(" pt"); never executed (the execution status of this line is deduced): suffix = QString::fromLatin1(" pt"); | - |
514 | break; | 0 |
515 | case 1: | - |
516 | default: | - |
517 | m_currentMultiplier = qt_multiplierForUnit(QPrinter::Millimeter, 1); never executed (the execution status of this line is deduced): m_currentMultiplier = qt_multiplierForUnit(QPrinter::Millimeter, 1); | - |
518 | suffix = QString::fromLatin1(" mm"); never executed (the execution status of this line is deduced): suffix = QString::fromLatin1(" mm"); | - |
519 | break; | 0 |
520 | } | - |
521 | const bool old = m_blockSignals; never executed (the execution status of this line is deduced): const bool old = m_blockSignals; | - |
522 | m_blockSignals = true; never executed (the execution status of this line is deduced): m_blockSignals = true; | - |
523 | widget.topMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.topMargin->setSuffix(suffix); | - |
524 | widget.leftMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.leftMargin->setSuffix(suffix); | - |
525 | widget.rightMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.rightMargin->setSuffix(suffix); | - |
526 | widget.bottomMargin->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.bottomMargin->setSuffix(suffix); | - |
527 | widget.paperWidth->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.paperWidth->setSuffix(suffix); | - |
528 | widget.paperHeight->setSuffix(suffix); never executed (the execution status of this line is deduced): widget.paperHeight->setSuffix(suffix); | - |
529 | widget.topMargin->setValue(m_topMargin / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.topMargin->setValue(m_topMargin / m_currentMultiplier); | - |
530 | widget.leftMargin->setValue(m_leftMargin / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.leftMargin->setValue(m_leftMargin / m_currentMultiplier); | - |
531 | widget.rightMargin->setValue(m_rightMargin / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.rightMargin->setValue(m_rightMargin / m_currentMultiplier); | - |
532 | widget.bottomMargin->setValue(m_bottomMargin / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.bottomMargin->setValue(m_bottomMargin / m_currentMultiplier); | - |
533 | widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); | - |
534 | widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); never executed (the execution status of this line is deduced): widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); | - |
535 | m_blockSignals = old; never executed (the execution status of this line is deduced): m_blockSignals = old; | - |
536 | } | 0 |
537 | | - |
538 | void QPageSetupWidget::setTopMargin(double newValue) | - |
539 | { | - |
540 | if (m_blockSignals) return; never executed: return; never evaluated: m_blockSignals | 0 |
541 | m_topMargin = newValue * m_currentMultiplier; never executed (the execution status of this line is deduced): m_topMargin = newValue * m_currentMultiplier; | - |
542 | m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); never executed (the execution status of this line is deduced): m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); | - |
543 | } | 0 |
544 | | - |
545 | void QPageSetupWidget::setBottomMargin(double newValue) | - |
546 | { | - |
547 | if (m_blockSignals) return; never executed: return; never evaluated: m_blockSignals | 0 |
548 | m_bottomMargin = newValue * m_currentMultiplier; never executed (the execution status of this line is deduced): m_bottomMargin = newValue * m_currentMultiplier; | - |
549 | m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); never executed (the execution status of this line is deduced): m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); | - |
550 | } | 0 |
551 | | - |
552 | void QPageSetupWidget::setLeftMargin(double newValue) | - |
553 | { | - |
554 | if (m_blockSignals) return; never executed: return; never evaluated: m_blockSignals | 0 |
555 | m_leftMargin = newValue * m_currentMultiplier; never executed (the execution status of this line is deduced): m_leftMargin = newValue * m_currentMultiplier; | - |
556 | m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); never executed (the execution status of this line is deduced): m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); | - |
557 | } | 0 |
558 | | - |
559 | void QPageSetupWidget::setRightMargin(double newValue) | - |
560 | { | - |
561 | if (m_blockSignals) return; never executed: return; never evaluated: m_blockSignals | 0 |
562 | m_rightMargin = newValue * m_currentMultiplier; never executed (the execution status of this line is deduced): m_rightMargin = newValue * m_currentMultiplier; | - |
563 | m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); never executed (the execution status of this line is deduced): m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); | - |
564 | } | 0 |
565 | | - |
566 | | - |
567 | | - |
568 | QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent) | - |
569 | : QDialog(*(new QUnixPageSetupDialogPrivate(printer)), parent) | - |
570 | { | - |
571 | setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); executed (the execution status of this line is deduced): setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); | - |
572 | } executed: } Execution Count:1 | 1 |
573 | | - |
574 | | - |
575 | QPageSetupDialog::QPageSetupDialog(QWidget *parent) | - |
576 | : QDialog(*(new QUnixPageSetupDialogPrivate(0)), parent) | - |
577 | { | - |
578 | setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); never executed (the execution status of this line is deduced): setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); | - |
579 | } | 0 |
580 | | - |
581 | int QPageSetupDialog::exec() | - |
582 | { | - |
583 | Q_D(QPageSetupDialog); never executed (the execution status of this line is deduced): QPageSetupDialogPrivate * const d = d_func(); | - |
584 | | - |
585 | int ret = QDialog::exec(); never executed (the execution status of this line is deduced): int ret = QDialog::exec(); | - |
586 | if (ret == Accepted) never evaluated: ret == Accepted | 0 |
587 | static_cast <QUnixPageSetupDialogPrivate*>(d)->widget->setupPrinter(); never executed: static_cast <QUnixPageSetupDialogPrivate*>(d)->widget->setupPrinter(); | 0 |
588 | return ret; never executed: return ret; | 0 |
589 | } | - |
590 | | - |
591 | | - |
592 | QT_END_NAMESPACE | - |
593 | | - |
594 | #include "moc_qpagesetupdialog.cpp" | - |
595 | | - |
596 | #endif // QT_NO_PRINTDIALOG | - |
597 | | - |
| | |