OpenCoverage

qpagesetupdialog_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10class QPagePreview : public QWidget-
11{-
12public:-
13 QPagePreview(QWidget *parent) : QWidget(parent)-
14 {-
15 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);-
16 setMinimumSize(50, 50);-
17 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
18-
19 void setPageLayout(const QPageLayout &layout)-
20 {-
21 m_pageLayout = layout;-
22 update();-
23 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
24-
25 void setPagePreviewLayout(int columns, int rows)-
26 {-
27 m_pagePreviewColumns = columns;-
28 m_pagePreviewRows = rows;-
29 update();-
30 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
31-
32protected:-
33 void paintEvent(QPaintEvent *) override-
34 {-
35 QSize pageSize = m_pageLayout.fullRectPoints().size();-
36 QSizeF scaledSize = pageSize.scaled(width() - 10, height() - 10, Qt::KeepAspectRatio);-
37 QRect pageRect = QRect(QPoint(0,0), scaledSize.toSize());-
38 pageRect.moveCenter(rect().center());-
39 qreal width_factor = scaledSize.width() / pageSize.width();-
40 qreal height_factor = scaledSize.height() / pageSize.height();-
41 QMarginsF margins = m_pageLayout.margins(QPageLayout::Point);-
42 int left = qRound(margins.left() * width_factor);-
43 int top = qRound(margins.top() * height_factor);-
44 int right = qRound(margins.right() * width_factor);-
45 int bottom = qRound(margins.bottom() * height_factor);-
46 QRect marginRect(pageRect.x() + left, pageRect.y() + top,-
47 pageRect.width() - (left + right + 1), pageRect.height() - (top + bottom + 1));-
48-
49 QPainter p(this);-
50 QColor shadow(palette().mid().color());-
51 for (int i=1; i<6
i<6Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
52 shadow.setAlpha(180-i*30);-
53 QRect offset(pageRect.adjusted(i, i, i, i));-
54 p.setPen(shadow);-
55 p.drawLine(offset.left(), offset.bottom(), offset.right(), offset.bottom());-
56 p.drawLine(offset.right(), offset.top(), offset.right(), offset.bottom()-1);-
57 }
never executed: end of block
0
58 p.fillRect(pageRect, palette().light());-
59-
60 if (marginRect.isValid()
marginRect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
61 p.setPen(QPen(palette().color(QPalette::Dark), 0, Qt::DotLine));-
62 p.drawRect(marginRect);-
63-
64 marginRect.adjust(2, 2, -1, -1);-
65 p.setClipRect(marginRect);-
66 QFont font;-
67 font.setPointSizeF(font.pointSizeF()*0.25);-
68 p.setFont(font);-
69 p.setPen(palette().color(QPalette::Dark));-
70 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."));-
71 for (int i=0; i<3
i<3Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
72 text += text;
never executed: text += text;
0
73-
74 const int spacing = pageRect.width() * 0.1;-
75 const int textWidth = (marginRect.width() - (spacing * (m_pagePreviewColumns-1))) / m_pagePreviewColumns;-
76 const int textHeight = (marginRect.height() - (spacing * (m_pagePreviewRows-1))) / m_pagePreviewRows;-
77-
78 for (int x = 0 ; x < m_pagePreviewColumns
x < m_pagePreviewColumnsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
79 for (int y = 0 ; y < m_pagePreviewRows
y < m_pagePreviewRowsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
80 QRect textRect(marginRect.left() + x * (textWidth + spacing),-
81 marginRect.top() + y * (textHeight + spacing),-
82 textWidth, textHeight);-
83 p.drawText(textRect, Qt::TextWordWrap|Qt::AlignVCenter, text);-
84 }
never executed: end of block
0
85 }
never executed: end of block
0
86 }
never executed: end of block
0
87 }
never executed: end of block
0
88-
89private:-
90-
91 QPageLayout m_pageLayout;-
92-
93 int m_pagePreviewColumns, m_pagePreviewRows;-
94};-
95-
96-
97-
98-
99-
100-
101class QUnixPageSetupDialogPrivate : public QPageSetupDialogPrivate-
102{-
103 inline QPageSetupDialog* q_func() { return static_cast<QPageSetupDialog *>(q_ptr); } inline const QPageSetupDialog* q_func() const { return static_cast<const QPageSetupDialog *>(q_ptr); } friend class QPageSetupDialog;-
104-
105public:-
106 QUnixPageSetupDialogPrivate(QPrinter *printer);-
107 ~QUnixPageSetupDialogPrivate();-
108 void init();-
109-
110 QPageSetupWidget *widget;-
111};-
112-
113QUnixPageSetupDialogPrivate::QUnixPageSetupDialogPrivate(QPrinter *printer) : QPageSetupDialogPrivate(printer)-
114{-
115}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
116-
117QUnixPageSetupDialogPrivate::~QUnixPageSetupDialogPrivate()-
118{-
119}-
120-
121void QUnixPageSetupDialogPrivate::init()-
122{-
123 QPageSetupDialog * const q = q_func();-
124-
125 widget = new QPageSetupWidget(q);-
126 widget->setPrinter(printer);-
127-
128 QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok-
129 | QDialogButtonBox::Cancel,-
130 Qt::Horizontal, q);-
131 QObject::connect(buttons, qFlagLocation("2""accepted()" "\0" __FILE__ ":" "217"), q, qFlagLocation("1""accept()" "\0" __FILE__ ":" "217"));-
132 QObject::connect(buttons, qFlagLocation("2""rejected()" "\0" __FILE__ ":" "218"), q, qFlagLocation("1""reject()" "\0" __FILE__ ":" "218"));-
133-
134 QVBoxLayout *lay = new QVBoxLayout(q);-
135 lay->addWidget(widget);-
136 lay->addWidget(buttons);-
137}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
138-
139-
140-
141-
142-
143-
144QPageSetupWidget::QPageSetupWidget(QWidget *parent)-
145 : QWidget(parent),-
146 m_pagePreview(0),-
147 m_printer(0),-
148 m_outputFormat(QPrinter::PdfFormat),-
149 m_units(QPageLayout::Point),-
150 m_blockSignals(false)-
151{-
152 m_ui.setupUi(this);-
153-
154 QVBoxLayout *lay = new QVBoxLayout(m_ui.preview);-
155 m_ui.preview->setLayout(lay);-
156 m_pagePreview = new QPagePreview(m_ui.preview);-
157 m_pagePreview->setPagePreviewLayout(1, 1);-
158-
159 lay->addWidget(m_pagePreview);-
160-
161 setAttribute(Qt::WA_WState_Polished, false);-
162-
163-
164-
165-
166-
167 m_ui.paperSourceLabel->setVisible(false);-
168 m_ui.paperSource->setVisible(false);-
169-
170-
171 m_ui.reverseLandscape->setVisible(false);-
172 m_ui.reversePortrait->setVisible(false);-
173-
174 initUnits();-
175 initPagesPerSheet();-
176-
177 connect(m_ui.unitCombo, qFlagLocation("2""activated(int)" "\0" __FILE__ ":" "263"), this, qFlagLocation("1""unitChanged()" "\0" __FILE__ ":" "263"));-
178-
179 connect(m_ui.pageSizeCombo, qFlagLocation("2""currentIndexChanged(int)" "\0" __FILE__ ":" "265"), this, qFlagLocation("1""pageSizeChanged()" "\0" __FILE__ ":" "265"));-
180 connect(m_ui.pageWidth, qFlagLocation("2""valueChanged(double)" "\0" __FILE__ ":" "266"), this, qFlagLocation("1""pageSizeChanged()" "\0" __FILE__ ":" "266"));-
181 connect(m_ui.pageHeight, qFlagLocation("2""valueChanged(double)" "\0" __FILE__ ":" "267"), this, qFlagLocation("1""pageSizeChanged()" "\0" __FILE__ ":" "267"));-
182-
183 connect(m_ui.leftMargin, qFlagLocation("2""valueChanged(double)" "\0" __FILE__ ":" "269"), this, qFlagLocation("1""leftMarginChanged(double)" "\0" __FILE__ ":" "269"));-
184 connect(m_ui.topMargin, qFlagLocation("2""valueChanged(double)" "\0" __FILE__ ":" "270"), this, qFlagLocation("1""topMarginChanged(double)" "\0" __FILE__ ":" "270"));-
185 connect(m_ui.rightMargin, qFlagLocation("2""valueChanged(double)" "\0" __FILE__ ":" "271"), this, qFlagLocation("1""rightMarginChanged(double)" "\0" __FILE__ ":" "271"));-
186 connect(m_ui.bottomMargin, qFlagLocation("2""valueChanged(double)" "\0" __FILE__ ":" "272"), this, qFlagLocation("1""bottomMarginChanged(double)" "\0" __FILE__ ":" "272"));-
187-
188 connect(m_ui.portrait, qFlagLocation("2""clicked()" "\0" __FILE__ ":" "274"), this, qFlagLocation("1""pageOrientationChanged()" "\0" __FILE__ ":" "274"));-
189 connect(m_ui.landscape, qFlagLocation("2""clicked()" "\0" __FILE__ ":" "275"), this, qFlagLocation("1""pageOrientationChanged()" "\0" __FILE__ ":" "275"));-
190-
191 connect(m_ui.pagesPerSheetCombo, qFlagLocation("2""currentIndexChanged(int)" "\0" __FILE__ ":" "277"), this, qFlagLocation("1""pagesPerSheetChanged()" "\0" __FILE__ ":" "277"));-
192}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
193-
194-
195void QPageSetupWidget::initUnits()-
196{-
197 m_ui.unitCombo->addItem(tr("Millimeters (mm)"), QVariant::fromValue(QPageLayout::Millimeter));-
198 m_ui.unitCombo->addItem(tr("Inches (in)"), QVariant::fromValue(QPageLayout::Inch));-
199 m_ui.unitCombo->addItem(tr("Points (pt)"), QVariant::fromValue(QPageLayout::Point));-
200 m_ui.unitCombo->addItem(tr("Pica (P̸)"), QVariant::fromValue(QPageLayout::Pica));-
201 m_ui.unitCombo->addItem(tr("Didot (DD)"), QVariant::fromValue(QPageLayout::Didot));-
202 m_ui.unitCombo->addItem(tr("Cicero (CC)"), QVariant::fromValue(QPageLayout::Cicero));-
203-
204-
205 m_ui.unitCombo->setCurrentIndex(QLocale().measurementSystem() != QLocale::MetricSystem);-
206}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
207-
208-
209void QPageSetupWidget::initPagesPerSheet()-
210{-
211-
212 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Left to Right, Top to Bottom"),-
213 QVariant::fromValue(QCUPSSupport::LeftToRightTopToBottom));-
214 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Left to Right, Bottom to Top"),-
215 QVariant::fromValue(QCUPSSupport::LeftToRightBottomToTop));-
216 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Right to Left, Bottom to Top"),-
217 QVariant::fromValue(QCUPSSupport::RightToLeftBottomToTop));-
218 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Right to Left, Top to Bottom"),-
219 QVariant::fromValue(QCUPSSupport::RightToLeftTopToBottom));-
220 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Bottom to Top, Left to Right"),-
221 QVariant::fromValue(QCUPSSupport::BottomToTopLeftToRight));-
222 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Bottom to Top, Right to Left"),-
223 QVariant::fromValue(QCUPSSupport::BottomToTopRightToLeft));-
224 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Top to Bottom, Left to Right"),-
225 QVariant::fromValue(QCUPSSupport::TopToBottomLeftToRight));-
226 m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Top to Bottom, Right to Left"),-
227 QVariant::fromValue(QCUPSSupport::TopToBottomRightToLeft));-
228-
229 m_ui.pagesPerSheetCombo->addItem(QPrintDialog::tr("1 (1x1)"),-
230 QVariant::fromValue(QCUPSSupport::OnePagePerSheet));-
231 m_ui.pagesPerSheetCombo->addItem(QPrintDialog::tr("2 (2x1)"),-
232 QVariant::fromValue(QCUPSSupport::TwoPagesPerSheet));-
233 m_ui.pagesPerSheetCombo->addItem(QPrintDialog::tr("4 (2x2)"),-
234 QVariant::fromValue(QCUPSSupport::FourPagesPerSheet));-
235 m_ui.pagesPerSheetCombo->addItem(QPrintDialog::tr("6 (2x3)"),-
236 QVariant::fromValue(QCUPSSupport::SixPagesPerSheet));-
237 m_ui.pagesPerSheetCombo->addItem(QPrintDialog::tr("9 (3x3)"),-
238 QVariant::fromValue(QCUPSSupport::NinePagesPerSheet));-
239 m_ui.pagesPerSheetCombo->addItem(QPrintDialog::tr("16 (4x4)"),-
240 QVariant::fromValue(QCUPSSupport::SixteenPagesPerSheet));-
241-
242-
243 m_ui.pagesPerSheetCombo->setCurrentIndex(0);-
244-
245 m_ui.pagesPerSheetLayoutCombo->setCurrentIndex(0);-
246-
247-
248-
249-
250}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
251-
252void QPageSetupWidget::initPageSizes()-
253{-
254 m_blockSignals = true;-
255-
256 m_ui.pageSizeCombo->clear();-
257-
258 if (m_outputFormat == QPrinter::NativeFormat
m_outputFormat...::NativeFormatDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
&& !m_printerName.isEmpty()
!m_printerName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-1
259 QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();-
260 if (ps
psDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
261 QPrintDevice printDevice = ps->createPrintDevice(m_printerName);-
262 const auto pageSizes = printDevice.supportedPageSizes();-
263 for (const QPageSize &pageSize : pageSizes)-
264 m_ui.pageSizeCombo->addItem(pageSize.name(), QVariant::fromValue(pageSize.id()));
never executed: m_ui.pageSizeCombo->addItem(pageSize.name(), QVariant::fromValue(pageSize.id()));
0
265 if (m_ui.pageSizeCombo->count() > 0
m_ui.pageSizeC...o->count() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& printDevice.supportsCustomPageSizes()
printDevice.su...tomPageSizes()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
266 m_ui.pageSizeCombo->addItem(tr("Custom"), QVariant::fromValue(QPageSize::Custom));-
267 m_blockSignals = false;-
268 return;
never executed: return;
0
269 }-
270 }
never executed: end of block
0
271 }
never executed: end of block
0
272-
273-
274 for (int id = 0; id < QPageSize::LastPageSize
id < QPageSize::LastPageSizeDescription
TRUEevaluated 118 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
; ++id) {
1-118
275 if (QPageSize::PageSizeId(id) == QPageSize::Custom
QPageSize::Pag...geSize::CustomDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 117 times by 1 test
Evaluated by:
  • tst_QPrinter
) {
1-117
276 m_ui.pageSizeCombo->addItem(tr("Custom"), QVariant::fromValue(QPageSize::Custom));-
277 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
else {
1
278 QPageSize pageSize = QPageSize(QPageSize::PageSizeId(id));-
279 m_ui.pageSizeCombo->addItem(pageSize.name(), QVariant::fromValue(pageSize.id()));-
280 }
executed 117 times by 1 test: end of block
Executed by:
  • tst_QPrinter
117
281 }-
282-
283 m_blockSignals = false;-
284}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
285-
286-
287-
288void QPageSetupWidget::setPrinter(QPrinter *printer)-
289{-
290 m_printer = printer;-
291-
292-
293 m_pageLayout = m_printer->pageLayout();-
294-
295 if (m_pageLayout.units() == QPageLayout::Point
m_pageLayout.u...eLayout::PointDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-1
296 if (QLocale().measurementSystem() == QLocale::MetricSystem
QLocale().meas...::MetricSystemDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
)
0-1
297 m_pageLayout.setUnits(QPageLayout::Millimeter);
never executed: m_pageLayout.setUnits(QPageLayout::Millimeter);
0
298 else-
299 m_pageLayout.setUnits(QPageLayout::Inch);
executed 1 time by 1 test: m_pageLayout.setUnits(QPageLayout::Inch);
Executed by:
  • tst_QPrinter
1
300 }-
301 m_units = m_pageLayout.units();-
302 m_pagePreview->setPageLayout(m_pageLayout);-
303-
304-
305 selectPrinter(m_printer->outputFormat(), m_printer->printerName());-
306}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
307-
308-
309-
310void QPageSetupWidget::selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName)-
311{-
312 m_outputFormat = outputFormat;-
313 m_printerName = printerName;-
314 initPageSizes();-
315 updateWidget();-
316}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
317-
318-
319-
320void QPageSetupWidget::updateWidget()-
321{-
322 m_blockSignals = true;-
323-
324 QString suffix;-
325 switch (m_units) {-
326 case
never executed: case QPageLayout::Millimeter:
QPageLayout::Millimeter:
never executed: case QPageLayout::Millimeter:
0
327-
328 suffix = tr("mm");-
329 break;
never executed: break;
0
330 case
never executed: case QPageLayout::Point:
QPageLayout::Point:
never executed: case QPageLayout::Point:
0
331-
332 suffix = tr("pt");-
333 break;
never executed: break;
0
334 case
executed 1 time by 1 test: case QPageLayout::Inch:
Executed by:
  • tst_QPrinter
QPageLayout::Inch:
executed 1 time by 1 test: case QPageLayout::Inch:
Executed by:
  • tst_QPrinter
1
335-
336 suffix = tr("in");-
337 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
338 case
never executed: case QPageLayout::Pica:
QPageLayout::Pica:
never executed: case QPageLayout::Pica:
0
339-
340 suffix = tr("P̸");-
341 break;
never executed: break;
0
342 case
never executed: case QPageLayout::Didot:
QPageLayout::Didot:
never executed: case QPageLayout::Didot:
0
343-
344 suffix = tr("DD");-
345 break;
never executed: break;
0
346 case
never executed: case QPageLayout::Cicero:
QPageLayout::Cicero:
never executed: case QPageLayout::Cicero:
0
347-
348 suffix = tr("CC");-
349 break;
never executed: break;
0
350 }-
351-
352 m_ui.unitCombo->setCurrentIndex(m_ui.unitCombo->findData(QVariant::fromValue(m_units)));-
353-
354 m_ui.pageSizeCombo->setCurrentIndex(m_ui.pageSizeCombo->findData(QVariant::fromValue(m_pageLayout.pageSize().id())));-
355-
356 QMarginsF min;-
357 QMarginsF max;-
358-
359 if (m_pageLayout.mode() == QPageLayout::FullPageMode
m_pageLayout.m...::FullPageModeDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) {
0-1
360 min = QMarginsF(0.0, 0.0, 0.0, 0.0);-
361 max = QMarginsF(9999.9999, 9999.9999, 9999.9999, 9999.9999);-
362 }
never executed: end of block
else {
0
363 min = m_pageLayout.minimumMargins();-
364 max = m_pageLayout.maximumMargins();-
365 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
366-
367 m_ui.leftMargin->setSuffix(suffix);-
368 m_ui.leftMargin->setMinimum(min.left());-
369 m_ui.leftMargin->setMaximum(max.left());-
370 m_ui.leftMargin->setValue(m_pageLayout.margins().left());-
371-
372 m_ui.rightMargin->setSuffix(suffix);-
373 m_ui.rightMargin->setMinimum(min.right());-
374 m_ui.rightMargin->setMaximum(max.right());-
375 m_ui.rightMargin->setValue(m_pageLayout.margins().right());-
376-
377 m_ui.topMargin->setSuffix(suffix);-
378 m_ui.topMargin->setMinimum(min.top());-
379 m_ui.topMargin->setMaximum(max.top());-
380 m_ui.topMargin->setValue(m_pageLayout.margins().top());-
381-
382 m_ui.bottomMargin->setSuffix(suffix);-
383 m_ui.bottomMargin->setMinimum(min.bottom());-
384 m_ui.bottomMargin->setMaximum(max.bottom());-
385 m_ui.bottomMargin->setValue(m_pageLayout.margins().bottom());-
386-
387 bool isCustom = m_ui.pageSizeCombo->currentData().value<QPageSize::PageSizeId>() == QPageSize::Custom;-
388-
389 m_ui.pageWidth->setSuffix(suffix);-
390 m_ui.pageWidth->setValue(m_pageLayout.fullRect(m_units).width());-
391 m_ui.pageWidth->setEnabled(isCustom);-
392 m_ui.widthLabel->setEnabled(isCustom);-
393-
394 m_ui.pageHeight->setSuffix(suffix);-
395 m_ui.pageHeight->setValue(m_pageLayout.fullRect(m_units).height());-
396 m_ui.pageHeight->setEnabled(isCustom);-
397 m_ui.heightLabel->setEnabled(isCustom);-
398-
399 m_ui.landscape->setChecked(m_pageLayout.orientation() == QPageLayout::Landscape);-
400-
401 m_ui.pagesPerSheetButtonGroup->setEnabled(m_outputFormat == QPrinter::NativeFormat);-
402-
403-
404-
405-
406-
407 m_blockSignals = false;-
408}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
409-
410-
411-
412void QPageSetupWidget::setupPrinter() const-
413{-
414 m_printer->setPageLayout(m_pageLayout);-
415-
416 QCUPSSupport::PagesPerSheet pagesPerSheet = m_ui.pagesPerSheetCombo->currentData()-
417 .value<QCUPSSupport::PagesPerSheet>();-
418 QCUPSSupport::PagesPerSheetLayout pagesPerSheetLayout = m_ui.pagesPerSheetLayoutCombo->currentData()-
419 .value<QCUPSSupport::PagesPerSheetLayout>();-
420 QCUPSSupport::setPagesPerSheetLayout(m_printer, pagesPerSheet, pagesPerSheetLayout);-
421-
422-
423-
424-
425}
never executed: end of block
0
426-
427-
428void QPageSetupWidget::pageSizeChanged()-
429{-
430 if (m_blockSignals
m_blockSignalsDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-3
431 return;
executed 3 times by 1 test: return;
Executed by:
  • tst_QPrinter
3
432-
433 QPageSize::PageSizeId id = m_ui.pageSizeCombo->currentData().value<QPageSize::PageSizeId>();-
434 if (id != QPageSize::Custom
id != QPageSize::CustomDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
435-
436 m_pageLayout.setPageSize(QPageSize(id));-
437 }
never executed: end of block
else {
0
438 QSizeF customSize;-
439 if (m_pageLayout.orientation() == QPageLayout::Landscape
m_pageLayout.o...out::LandscapeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
440 customSize = QSizeF(m_ui.pageHeight->value(), m_ui.pageWidth->value());
never executed: customSize = QSizeF(m_ui.pageHeight->value(), m_ui.pageWidth->value());
0
441 else-
442 customSize = QSizeF(m_ui.pageWidth->value(), m_ui.pageHeight->value());
never executed: customSize = QSizeF(m_ui.pageWidth->value(), m_ui.pageHeight->value());
0
443-
444 m_pageLayout.setPageSize(QPageSize(customSize, QPageSize::Unit(m_units)));-
445 }
never executed: end of block
0
446 m_pagePreview->setPageLayout(m_pageLayout);-
447-
448 updateWidget();-
449}
never executed: end of block
0
450-
451void QPageSetupWidget::pageOrientationChanged()-
452{-
453 if (m_blockSignals
m_blockSignalsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
454 return;
never executed: return;
0
455 m_pageLayout.setOrientation(m_ui.portrait->isChecked() ? QPageLayout::Portrait : QPageLayout::Landscape);-
456 m_pagePreview->setPageLayout(m_pageLayout);-
457 updateWidget();-
458}
never executed: end of block
0
459-
460void QPageSetupWidget::pagesPerSheetChanged()-
461{-
462-
463 switch (m_ui.pagesPerSheetCombo->currentData().toInt()) {-
464 case
never executed: case QCUPSSupport::OnePagePerSheet:
QCUPSSupport::OnePagePerSheet:
never executed: case QCUPSSupport::OnePagePerSheet:
0
465 m_pagePreview->setPagePreviewLayout(1, 1);-
466 break;
never executed: break;
0
467 case
never executed: case QCUPSSupport::TwoPagesPerSheet:
QCUPSSupport::TwoPagesPerSheet:
never executed: case QCUPSSupport::TwoPagesPerSheet:
0
468 m_pagePreview->setPagePreviewLayout(1, 2);-
469 break;
never executed: break;
0
470 case
never executed: case QCUPSSupport::FourPagesPerSheet:
QCUPSSupport::FourPagesPerSheet:
never executed: case QCUPSSupport::FourPagesPerSheet:
0
471 m_pagePreview->setPagePreviewLayout(2, 2);-
472 break;
never executed: break;
0
473 case
never executed: case QCUPSSupport::SixPagesPerSheet:
QCUPSSupport::SixPagesPerSheet:
never executed: case QCUPSSupport::SixPagesPerSheet:
0
474 m_pagePreview->setPagePreviewLayout(3, 2);-
475 break;
never executed: break;
0
476 case
never executed: case QCUPSSupport::NinePagesPerSheet:
QCUPSSupport::NinePagesPerSheet:
never executed: case QCUPSSupport::NinePagesPerSheet:
0
477 m_pagePreview->setPagePreviewLayout(3, 3);-
478 break;
never executed: break;
0
479 case
never executed: case QCUPSSupport::SixteenPagesPerSheet:
QCUPSSupport::SixteenPagesPerSheet:
never executed: case QCUPSSupport::SixteenPagesPerSheet:
0
480 m_pagePreview->setPagePreviewLayout(4, 4);-
481 break;
never executed: break;
0
482 }-
483-
484}
never executed: end of block
0
485-
486void QPageSetupWidget::unitChanged()-
487{-
488 if (m_blockSignals
m_blockSignalsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
489 return;
never executed: return;
0
490 m_units = m_ui.unitCombo->currentData().value<QPageLayout::Unit>();-
491 m_pageLayout.setUnits(m_units);-
492 updateWidget();-
493}
never executed: end of block
0
494-
495void QPageSetupWidget::topMarginChanged(double newValue)-
496{-
497 if (m_blockSignals
m_blockSignalsDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
498 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QPrinter
1
499 m_pageLayout.setTopMargin(newValue);-
500 m_pagePreview->setPageLayout(m_pageLayout);-
501}
never executed: end of block
0
502-
503void QPageSetupWidget::bottomMarginChanged(double newValue)-
504{-
505 if (m_blockSignals
m_blockSignalsDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
506 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QPrinter
1
507 m_pageLayout.setBottomMargin(newValue);-
508 m_pagePreview->setPageLayout(m_pageLayout);-
509}
never executed: end of block
0
510-
511void QPageSetupWidget::leftMarginChanged(double newValue)-
512{-
513 if (m_blockSignals
m_blockSignalsDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
514 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QPrinter
1
515 m_pageLayout.setLeftMargin(newValue);-
516 m_pagePreview->setPageLayout(m_pageLayout);-
517}
never executed: end of block
0
518-
519void QPageSetupWidget::rightMarginChanged(double newValue)-
520{-
521 if (m_blockSignals
m_blockSignalsDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
522 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QPrinter
1
523 m_pageLayout.setRightMargin(newValue);-
524 m_pagePreview->setPageLayout(m_pageLayout);-
525}
never executed: end of block
0
526-
527-
528-
529-
530QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent)-
531 : QDialog(*(new QUnixPageSetupDialogPrivate(printer)), parent)-
532{-
533 QPageSetupDialogPrivate * const d = d_func();-
534 setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup"));-
535 static_cast<QUnixPageSetupDialogPrivate *>(d)->init();-
536}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
537-
538QPageSetupDialog::QPageSetupDialog(QWidget *parent)-
539 : QDialog(*(new QUnixPageSetupDialogPrivate(0)), parent)-
540{-
541 QPageSetupDialogPrivate * const d = d_func();-
542 setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup"));-
543 static_cast<QUnixPageSetupDialogPrivate *>(d)->init();-
544}
never executed: end of block
0
545-
546int QPageSetupDialog::exec()-
547{-
548 QPageSetupDialogPrivate * const d = d_func();-
549-
550 int ret = QDialog::exec();-
551 if (ret == Accepted
ret == AcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
552 static_cast
never executed: static_cast <QUnixPageSetupDialogPrivate*>(d)->widget->setupPrinter();
<QUnixPageSetupDialogPrivate*>(d)->widget->setupPrinter();
never executed: static_cast <QUnixPageSetupDialogPrivate*>(d)->widget->setupPrinter();
0
553 return
never executed: return ret;
ret;
never executed: return ret;
0
554}-
555-
556-
557-
Switch to Source codePreprocessed file

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