qpagelayout.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpagelayout.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7__attribute__((visibility("default"))) qreal qt_pointMultiplier(QPageLayout::Unit unit)-
8{-
9 switch (unit) {-
10 case
never executed: case QPageLayout::Millimeter:
QPageLayout::Millimeter:
never executed: case QPageLayout::Millimeter:
0
11 return
never executed: return 2.83464566929;
2.83464566929;
never executed: return 2.83464566929;
0
12 case
never executed: case QPageLayout::Point:
QPageLayout::Point:
never executed: case QPageLayout::Point:
0
13 return
never executed: return 1.0;
1.0;
never executed: return 1.0;
0
14 case
never executed: case QPageLayout::Inch:
QPageLayout::Inch:
never executed: case QPageLayout::Inch:
0
15 return
never executed: return 72.0;
72.0;
never executed: return 72.0;
0
16 case
never executed: case QPageLayout::Pica:
QPageLayout::Pica:
never executed: case QPageLayout::Pica:
0
17 return
never executed: return 12;
12;
never executed: return 12;
0
18 case
never executed: case QPageLayout::Didot:
QPageLayout::Didot:
never executed: case QPageLayout::Didot:
0
19 return
never executed: return 1.065826771;
1.065826771;
never executed: return 1.065826771;
0
20 case
never executed: case QPageLayout::Cicero:
QPageLayout::Cicero:
never executed: case QPageLayout::Cicero:
0
21 return
never executed: return 12.789921252;
12.789921252;
never executed: return 12.789921252;
0
22 }-
23 return
never executed: return 1.0;
1.0;
never executed: return 1.0;
0
24}-
25-
26-
27extern qreal qt_pixelMultiplier(int resolution);-
28-
29QPointF qt_convertPoint(const QPointF &xy, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)-
30{-
31-
32 if (fromUnits == toUnits
fromUnits == toUnitsDescription
TRUEnever evaluated
FALSEnever evaluated
|| xy.isNull()
xy.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
33 return
never executed: return xy;
xy;
never executed: return xy;
0
34-
35-
36 if (toUnits == QPageLayout::Point
toUnits == QPageLayout::PointDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
37 const qreal multiplier = qt_pointMultiplier(fromUnits);-
38 return
never executed: return QPointF(qRound(xy.x() * multiplier), qRound(xy.y() * multiplier));
QPointF(qRound(xy.x() * multiplier),
never executed: return QPointF(qRound(xy.x() * multiplier), qRound(xy.y() * multiplier));
0
39 qRound(xy.y() * multiplier));
never executed: return QPointF(qRound(xy.x() * multiplier), qRound(xy.y() * multiplier));
0
40 }-
41-
42-
43 QPointF pointXy = (
(fromUnits == ...Layout::Point)Description
TRUEnever evaluated
FALSEnever evaluated
fromUnits == QPageLayout::Point)
(fromUnits == ...Layout::Point)Description
TRUEnever evaluated
FALSEnever evaluated
? xy : xy * qt_pointMultiplier(fromUnits);
0
44-
45-
46 const qreal multiplier = qt_pointMultiplier(toUnits);-
47 return
never executed: return QPointF(qRound(pointXy.x() * 100 / multiplier) / 100.0, qRound(pointXy.y() * 100 / multiplier) / 100.0);
QPointF(qRound(pointXy.x() * 100 / multiplier) / 100.0,
never executed: return QPointF(qRound(pointXy.x() * 100 / multiplier) / 100.0, qRound(pointXy.y() * 100 / multiplier) / 100.0);
0
48 qRound(pointXy.y() * 100 / multiplier) / 100.0);
never executed: return QPointF(qRound(pointXy.x() * 100 / multiplier) / 100.0, qRound(pointXy.y() * 100 / multiplier) / 100.0);
0
49}-
50-
51__attribute__((visibility("default"))) QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)-
52{-
53-
54 if (fromUnits == toUnits
fromUnits == toUnitsDescription
TRUEnever evaluated
FALSEnever evaluated
|| margins.isNull()
margins.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
55 return
never executed: return margins;
margins;
never executed: return margins;
0
56-
57-
58 if (toUnits == QPageLayout::Point
toUnits == QPageLayout::PointDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
59 const qreal multiplier = qt_pointMultiplier(fromUnits);-
60 return
never executed: return QMarginsF(qRound(margins.left() * multiplier), qRound(margins.top() * multiplier), qRound(margins.right() * multiplier), qRound(margins.bottom() * multiplier));
QMarginsF(qRound(margins.left() * multiplier),
never executed: return QMarginsF(qRound(margins.left() * multiplier), qRound(margins.top() * multiplier), qRound(margins.right() * multiplier), qRound(margins.bottom() * multiplier));
0
61 qRound(margins.top() * multiplier),
never executed: return QMarginsF(qRound(margins.left() * multiplier), qRound(margins.top() * multiplier), qRound(margins.right() * multiplier), qRound(margins.bottom() * multiplier));
0
62 qRound(margins.right() * multiplier),
never executed: return QMarginsF(qRound(margins.left() * multiplier), qRound(margins.top() * multiplier), qRound(margins.right() * multiplier), qRound(margins.bottom() * multiplier));
0
63 qRound(margins.bottom() * multiplier));
never executed: return QMarginsF(qRound(margins.left() * multiplier), qRound(margins.top() * multiplier), qRound(margins.right() * multiplier), qRound(margins.bottom() * multiplier));
0
64 }-
65-
66-
67 QMarginsF pointMargins = fromUnits == QPageLayout::Point
fromUnits == Q...eLayout::PointDescription
TRUEnever evaluated
FALSEnever evaluated
? margins : margins * qt_pointMultiplier(fromUnits);
0
68-
69-
70 const qreal multiplier = qt_pointMultiplier(toUnits);-
71 return
never executed: return QMarginsF(qRound(pointMargins.left() * 100 / multiplier) / 100.0, qRound(pointMargins.top() * 100 / multiplier) / 100.0, qRound(pointMargins.right() * 100 / multiplier) / 100.0, qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
QMarginsF(qRound(pointMargins.left() * 100 / multiplier) / 100.0,
never executed: return QMarginsF(qRound(pointMargins.left() * 100 / multiplier) / 100.0, qRound(pointMargins.top() * 100 / multiplier) / 100.0, qRound(pointMargins.right() * 100 / multiplier) / 100.0, qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
0
72 qRound(pointMargins.top() * 100 / multiplier) / 100.0,
never executed: return QMarginsF(qRound(pointMargins.left() * 100 / multiplier) / 100.0, qRound(pointMargins.top() * 100 / multiplier) / 100.0, qRound(pointMargins.right() * 100 / multiplier) / 100.0, qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
0
73 qRound(pointMargins.right() * 100 / multiplier) / 100.0,
never executed: return QMarginsF(qRound(pointMargins.left() * 100 / multiplier) / 100.0, qRound(pointMargins.top() * 100 / multiplier) / 100.0, qRound(pointMargins.right() * 100 / multiplier) / 100.0, qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
0
74 qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
never executed: return QMarginsF(qRound(pointMargins.left() * 100 / multiplier) / 100.0, qRound(pointMargins.top() * 100 / multiplier) / 100.0, qRound(pointMargins.right() * 100 / multiplier) / 100.0, qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
0
75}-
76-
77class QPageLayoutPrivate : public QSharedData-
78{-
79public:-
80-
81 QPageLayoutPrivate();-
82 QPageLayoutPrivate(const QPageSize &pageSize, QPageLayout::Orientation orientation,-
83 const QMarginsF &margins, QPageLayout::Unit units,-
84 const QMarginsF &minMargins);-
85 ~QPageLayoutPrivate();-
86-
87 bool operator==(const QPageLayoutPrivate &other) const;-
88 bool isEquivalentTo(const QPageLayoutPrivate &other) const;-
89-
90 bool isValid() const;-
91-
92 void clampMargins(const QMarginsF &margins);-
93-
94 QMarginsF margins(QPageLayout::Unit units) const;-
95 QMargins marginsPoints() const;-
96 QMargins marginsPixels(int resolution) const;-
97-
98 void setDefaultMargins(const QMarginsF &minMargins);-
99-
100 QSizeF paintSize() const;-
101-
102 QRectF fullRect() const;-
103 QRectF fullRect(QPageLayout::Unit units) const;-
104 QRect fullRectPoints() const;-
105 QRect fullRectPixels(int resolution) const;-
106-
107 QRectF paintRect() const;-
108-
109private:-
110 friend class QPageLayout;-
111-
112 QSizeF fullSizeUnits(QPageLayout::Unit units) const;-
113-
114 QPageSize m_pageSize;-
115 QPageLayout::Orientation m_orientation;-
116 QPageLayout::Mode m_mode;-
117 QPageLayout::Unit m_units;-
118 QSizeF m_fullSize;-
119 QMarginsF m_margins;-
120 QMarginsF m_minMargins;-
121 QMarginsF m_maxMargins;-
122};-
123-
124QPageLayoutPrivate::QPageLayoutPrivate()-
125 : m_orientation(QPageLayout::Landscape),-
126 m_mode(QPageLayout::StandardMode)-
127{-
128}
never executed: end of block
0
129-
130QPageLayoutPrivate::QPageLayoutPrivate(const QPageSize &pageSize, QPageLayout::Orientation orientation,-
131 const QMarginsF &margins, QPageLayout::Unit units,-
132 const QMarginsF &minMargins)-
133 : m_pageSize(pageSize),-
134 m_orientation(orientation),-
135 m_mode(QPageLayout::StandardMode),-
136 m_units(units),-
137 m_margins(margins)-
138{-
139 m_fullSize = fullSizeUnits(m_units);-
140 setDefaultMargins(minMargins);-
141}
never executed: end of block
0
142-
143QPageLayoutPrivate::~QPageLayoutPrivate()-
144{-
145}-
146-
147bool QPageLayoutPrivate::operator==(const QPageLayoutPrivate &other) const-
148{-
149 return
never executed: return m_pageSize == other.m_pageSize && m_orientation == other.m_orientation && m_units == other.m_units && m_margins == other.m_margins && m_minMargins == other.m_minMargins && m_maxMargins == other.m_maxMargins;
m_pageSize == other.m_pageSize
never executed: return m_pageSize == other.m_pageSize && m_orientation == other.m_orientation && m_units == other.m_units && m_margins == other.m_margins && m_minMargins == other.m_minMargins && m_maxMargins == other.m_maxMargins;
0
150 && m_orientation == other.m_orientation
never executed: return m_pageSize == other.m_pageSize && m_orientation == other.m_orientation && m_units == other.m_units && m_margins == other.m_margins && m_minMargins == other.m_minMargins && m_maxMargins == other.m_maxMargins;
0
151 && m_units == other.m_units
never executed: return m_pageSize == other.m_pageSize && m_orientation == other.m_orientation && m_units == other.m_units && m_margins == other.m_margins && m_minMargins == other.m_minMargins && m_maxMargins == other.m_maxMargins;
0
152 && m_margins == other.m_margins
never executed: return m_pageSize == other.m_pageSize && m_orientation == other.m_orientation && m_units == other.m_units && m_margins == other.m_margins && m_minMargins == other.m_minMargins && m_maxMargins == other.m_maxMargins;
0
153 && m_minMargins == other.m_minMargins
never executed: return m_pageSize == other.m_pageSize && m_orientation == other.m_orientation && m_units == other.m_units && m_margins == other.m_margins && m_minMargins == other.m_minMargins && m_maxMargins == other.m_maxMargins;
0
154 && m_maxMargins == other.m_maxMargins;
never executed: return m_pageSize == other.m_pageSize && m_orientation == other.m_orientation && m_units == other.m_units && m_margins == other.m_margins && m_minMargins == other.m_minMargins && m_maxMargins == other.m_maxMargins;
0
155}-
156-
157bool QPageLayoutPrivate::isEquivalentTo(const QPageLayoutPrivate &other) const-
158{-
159 return
never executed: return m_pageSize.isEquivalentTo(other.m_pageSize) && m_orientation == other.m_orientation && qt_convertMargins(m_margins, m_units, QPageLayout::Point) == qt_convertMargins(other.m_margins, other.m_units, QPageLayout::Point);
m_pageSize.isEquivalentTo(other.m_pageSize)
never executed: return m_pageSize.isEquivalentTo(other.m_pageSize) && m_orientation == other.m_orientation && qt_convertMargins(m_margins, m_units, QPageLayout::Point) == qt_convertMargins(other.m_margins, other.m_units, QPageLayout::Point);
0
160 && m_orientation == other.m_orientation
never executed: return m_pageSize.isEquivalentTo(other.m_pageSize) && m_orientation == other.m_orientation && qt_convertMargins(m_margins, m_units, QPageLayout::Point) == qt_convertMargins(other.m_margins, other.m_units, QPageLayout::Point);
0
161 && qt_convertMargins(m_margins, m_units, QPageLayout::Point)
never executed: return m_pageSize.isEquivalentTo(other.m_pageSize) && m_orientation == other.m_orientation && qt_convertMargins(m_margins, m_units, QPageLayout::Point) == qt_convertMargins(other.m_margins, other.m_units, QPageLayout::Point);
0
162 == qt_convertMargins(other.m_margins, other.m_units, QPageLayout::Point);
never executed: return m_pageSize.isEquivalentTo(other.m_pageSize) && m_orientation == other.m_orientation && qt_convertMargins(m_margins, m_units, QPageLayout::Point) == qt_convertMargins(other.m_margins, other.m_units, QPageLayout::Point);
0
163}-
164-
165bool QPageLayoutPrivate::isValid() const-
166{-
167 return
never executed: return m_pageSize.isValid();
m_pageSize.isValid();
never executed: return m_pageSize.isValid();
0
168}-
169-
170void QPageLayoutPrivate::clampMargins(const QMarginsF &margins)-
171{-
172 m_margins = QMarginsF(qBound(m_minMargins.left(), margins.left(), m_maxMargins.left()),-
173 qBound(m_minMargins.top(), margins.top(), m_maxMargins.top()),-
174 qBound(m_minMargins.right(), margins.right(), m_maxMargins.right()),-
175 qBound(m_minMargins.bottom(), margins.bottom(), m_maxMargins.bottom()));-
176}
never executed: end of block
0
177-
178QMarginsF QPageLayoutPrivate::margins(QPageLayout::Unit units) const-
179{-
180 return
never executed: return qt_convertMargins(m_margins, m_units, units);
qt_convertMargins(m_margins, m_units, units);
never executed: return qt_convertMargins(m_margins, m_units, units);
0
181}-
182-
183QMargins QPageLayoutPrivate::marginsPoints() const-
184{-
185 return
never executed: return qt_convertMargins(m_margins, m_units, QPageLayout::Point).toMargins();
qt_convertMargins(m_margins, m_units, QPageLayout::Point).toMargins();
never executed: return qt_convertMargins(m_margins, m_units, QPageLayout::Point).toMargins();
0
186}-
187-
188QMargins QPageLayoutPrivate::marginsPixels(int resolution) const-
189{-
190 return
never executed: return marginsPoints() / qt_pixelMultiplier(resolution);
marginsPoints() / qt_pixelMultiplier(resolution);
never executed: return marginsPoints() / qt_pixelMultiplier(resolution);
0
191}-
192-
193void QPageLayoutPrivate::setDefaultMargins(const QMarginsF &minMargins)-
194{-
195 m_minMargins = minMargins;-
196 m_maxMargins = QMarginsF(m_fullSize.width() - m_minMargins.right(),-
197 m_fullSize.height() - m_minMargins.bottom(),-
198 m_fullSize.width() - m_minMargins.left(),-
199 m_fullSize.height() - m_minMargins.top());-
200 if (m_mode == QPageLayout::StandardMode
m_mode == QPag...::StandardModeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
201 clampMargins(m_margins);
never executed: clampMargins(m_margins);
0
202}
never executed: end of block
0
203-
204QSizeF QPageLayoutPrivate::fullSizeUnits(QPageLayout::Unit units) const-
205{-
206 QSizeF fullPageSize = m_pageSize.size(QPageSize::Unit(units));-
207 return
never executed: return m_orientation == QPageLayout::Landscape ? fullPageSize.transposed() : fullPageSize;
m_orientation == QPageLayout::Landscape ? fullPageSize.transposed() : fullPageSize;
never executed: return m_orientation == QPageLayout::Landscape ? fullPageSize.transposed() : fullPageSize;
0
208}-
209-
210QRectF QPageLayoutPrivate::fullRect() const-
211{-
212 return
never executed: return QRectF(QPointF(0, 0), m_fullSize);
QRectF(QPointF(0, 0), m_fullSize);
never executed: return QRectF(QPointF(0, 0), m_fullSize);
0
213}-
214-
215QRectF QPageLayoutPrivate::fullRect(QPageLayout::Unit units) const-
216{-
217 return
never executed: return units == m_units ? fullRect() : QRectF(QPointF(0, 0), fullSizeUnits(units));
units == m_units ? fullRect() : QRectF(QPointF(0, 0), fullSizeUnits(units));
never executed: return units == m_units ? fullRect() : QRectF(QPointF(0, 0), fullSizeUnits(units));
0
218}-
219-
220QRect QPageLayoutPrivate::fullRectPoints() const-
221{-
222 if (m_orientation == QPageLayout::Landscape
m_orientation ...out::LandscapeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
223 return
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePoints().transposed());
QRect(QPoint(0, 0), m_pageSize.sizePoints().transposed());
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePoints().transposed());
0
224 else-
225 return
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePoints());
QRect(QPoint(0, 0), m_pageSize.sizePoints());
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePoints());
0
226}-
227-
228QRect QPageLayoutPrivate::fullRectPixels(int resolution) const-
229{-
230 if (m_orientation == QPageLayout::Landscape
m_orientation ...out::LandscapeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
231 return
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution).transposed());
QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution).transposed());
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution).transposed());
0
232 else-
233 return
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution));
QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution));
never executed: return QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution));
0
234}-
235-
236QRectF QPageLayoutPrivate::paintRect() const-
237{-
238 return
never executed: return m_mode == QPageLayout::FullPageMode ? fullRect() : fullRect() - m_margins;
m_mode == QPageLayout::FullPageMode ? fullRect() : fullRect() - m_margins;
never executed: return m_mode == QPageLayout::FullPageMode ? fullRect() : fullRect() - m_margins;
0
239}-
240QPageLayout::QPageLayout()-
241 : d(new QPageLayoutPrivate())-
242{-
243}
never executed: end of block
0
244QPageLayout::QPageLayout(const QPageSize &pageSize, Orientation orientation,-
245 const QMarginsF &margins, Unit units,-
246 const QMarginsF &minMargins)-
247 : d(new QPageLayoutPrivate(pageSize, orientation, margins, units, minMargins))-
248{-
249}
never executed: end of block
0
250-
251-
252-
253-
254-
255QPageLayout::QPageLayout(const QPageLayout &other)-
256 : d(other.d)-
257{-
258}
never executed: end of block
0
259-
260-
261-
262-
263-
264QPageLayout::~QPageLayout()-
265{-
266}-
267-
268-
269-
270-
271-
272QPageLayout &QPageLayout::operator=(const QPageLayout &other)-
273{-
274 d = other.d;-
275 return
never executed: return *this;
*this;
never executed: return *this;
0
276}-
277bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)-
278{-
279 return
never executed: return lhs.d == rhs.d || *lhs.d == *rhs.d;
lhs.d == rhs.d || *lhs.d == *rhs.d;
never executed: return lhs.d == rhs.d || *lhs.d == *rhs.d;
0
280}-
281bool QPageLayout::isEquivalentTo(const QPageLayout &other) const-
282{-
283 return
never executed: return d && other.d && d->isEquivalentTo(*other.d);
d && other.d && d->isEquivalentTo(*other.d);
never executed: return d && other.d && d->isEquivalentTo(*other.d);
0
284}-
285-
286-
287-
288-
289-
290bool QPageLayout::isValid() const-
291{-
292 return
never executed: return d->isValid();
d->isValid();
never executed: return d->isValid();
0
293}-
294-
295-
296-
297-
298-
299void QPageLayout::setMode(Mode mode)-
300{-
301 d.detach();-
302 d->m_mode = mode;-
303}
never executed: end of block
0
304-
305-
306-
307-
308-
309QPageLayout::Mode QPageLayout::mode() const-
310{-
311 return
never executed: return d->m_mode;
d->m_mode;
never executed: return d->m_mode;
0
312}-
313void QPageLayout::setPageSize(const QPageSize &pageSize, const QMarginsF &minMargins)-
314{-
315 if (!pageSize.isValid()
!pageSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
316 return;
never executed: return;
0
317 d.detach();-
318 d->m_pageSize = pageSize;-
319 d->m_fullSize = d->fullSizeUnits(d->m_units);-
320 d->setDefaultMargins(minMargins);-
321}
never executed: end of block
0
322QPageSize QPageLayout::pageSize() const-
323{-
324 return
never executed: return d->m_pageSize;
d->m_pageSize;
never executed: return d->m_pageSize;
0
325}-
326void QPageLayout::setOrientation(Orientation orientation)-
327{-
328 if (orientation != d->m_orientation
orientation !=...>m_orientationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
329 d.detach();-
330 d->m_orientation = orientation;-
331 d->m_fullSize = d->fullSizeUnits(d->m_units);-
332-
333 const qreal change = d->m_fullSize.width() - d->m_fullSize.height();-
334 d->m_maxMargins.setLeft(d->m_maxMargins.left() + change);-
335 d->m_maxMargins.setRight(d->m_maxMargins.right() + change);-
336 d->m_maxMargins.setTop(d->m_maxMargins.top() - change);-
337 d->m_maxMargins.setBottom(d->m_maxMargins.bottom() - change);-
338 }
never executed: end of block
0
339}
never executed: end of block
0
340-
341-
342-
343-
344-
345QPageLayout::Orientation QPageLayout::orientation() const-
346{-
347 return
never executed: return d->m_orientation;
d->m_orientation;
never executed: return d->m_orientation;
0
348}-
349-
350-
351-
352-
353-
354void QPageLayout::setUnits(Unit units)-
355{-
356 if (units != d->m_units
units != d->m_unitsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
357 d.detach();-
358 d->m_margins = qt_convertMargins(d->m_margins, d->m_units, units);-
359 d->m_minMargins = qt_convertMargins(d->m_minMargins, d->m_units, units);-
360 d->m_maxMargins = qt_convertMargins(d->m_maxMargins, d->m_units, units);-
361 d->m_units = units;-
362 d->m_fullSize = d->fullSizeUnits(d->m_units);-
363 }
never executed: end of block
0
364}
never executed: end of block
0
365-
366-
367-
368-
369-
370QPageLayout::Unit QPageLayout::units() const-
371{-
372 return
never executed: return d->m_units;
d->m_units;
never executed: return d->m_units;
0
373}-
374bool QPageLayout::setMargins(const QMarginsF &margins)-
375{-
376 if (d->m_mode == FullPageMode
d->m_mode == FullPageModeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
377 d.detach();-
378 d->m_margins = margins;-
379 return
never executed: return true;
true;
never executed: return true;
0
380 } else if (margins.left() >= d->m_minMargins.left()
margins.left()...Margins.left()Description
TRUEnever evaluated
FALSEnever evaluated
0
381 && margins.right() >= d->m_minMargins.right()
margins.right(...argins.right()Description
TRUEnever evaluated
FALSEnever evaluated
0
382 && margins.top() >= d->m_minMargins.top()
margins.top() ...nMargins.top()Description
TRUEnever evaluated
FALSEnever evaluated
0
383 && margins.bottom() >= d->m_minMargins.bottom()
margins.bottom...rgins.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
0
384 && margins.left() <= d->m_maxMargins.left()
margins.left()...Margins.left()Description
TRUEnever evaluated
FALSEnever evaluated
0
385 && margins.right() <= d->m_maxMargins.right()
margins.right(...argins.right()Description
TRUEnever evaluated
FALSEnever evaluated
0
386 && margins.top() <= d->m_maxMargins.top()
margins.top() ...xMargins.top()Description
TRUEnever evaluated
FALSEnever evaluated
0
387 && margins.bottom() <= d->m_maxMargins.bottom()
margins.bottom...rgins.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
388 d.detach();-
389 d->m_margins = margins;-
390 return
never executed: return true;
true;
never executed: return true;
0
391 }-
392 return
never executed: return false;
false;
never executed: return false;
0
393}-
394bool QPageLayout::setLeftMargin(qreal leftMargin)-
395{-
396 if (d->m_mode == FullPageMode
d->m_mode == FullPageModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
397 || (leftMargin >= d->m_minMargins.left()
leftMargin >= ...Margins.left()Description
TRUEnever evaluated
FALSEnever evaluated
&& leftMargin <= d->m_maxMargins.left()
leftMargin <= ...Margins.left()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
398 d.detach();-
399 d->m_margins.setLeft(leftMargin);-
400 return
never executed: return true;
true;
never executed: return true;
0
401 }-
402 return
never executed: return false;
false;
never executed: return false;
0
403}-
404bool QPageLayout::setRightMargin(qreal rightMargin)-
405{-
406 if (d->m_mode == FullPageMode
d->m_mode == FullPageModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
407 || (rightMargin >= d->m_minMargins.right()
rightMargin >=...argins.right()Description
TRUEnever evaluated
FALSEnever evaluated
&& rightMargin <= d->m_maxMargins.right()
rightMargin <=...argins.right()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
408 d.detach();-
409 d->m_margins.setRight(rightMargin);-
410 return
never executed: return true;
true;
never executed: return true;
0
411 }-
412 return
never executed: return false;
false;
never executed: return false;
0
413}-
414bool QPageLayout::setTopMargin(qreal topMargin)-
415{-
416 if (d->m_mode == FullPageMode
d->m_mode == FullPageModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
417 || (topMargin >= d->m_minMargins.top()
topMargin >= d...nMargins.top()Description
TRUEnever evaluated
FALSEnever evaluated
&& topMargin <= d->m_maxMargins.top()
topMargin <= d...xMargins.top()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
418 d.detach();-
419 d->m_margins.setTop(topMargin);-
420 return
never executed: return true;
true;
never executed: return true;
0
421 }-
422 return
never executed: return false;
false;
never executed: return false;
0
423}-
424bool QPageLayout::setBottomMargin(qreal bottomMargin)-
425{-
426 if (d->m_mode == FullPageMode
d->m_mode == FullPageModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
427 || (bottomMargin >= d->m_minMargins.bottom()
bottomMargin >...rgins.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
&& bottomMargin <= d->m_maxMargins.bottom()
bottomMargin <...rgins.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
428 d.detach();-
429 d->m_margins.setBottom(bottomMargin);-
430 return
never executed: return true;
true;
never executed: return true;
0
431 }-
432 return
never executed: return false;
false;
never executed: return false;
0
433}-
434-
435-
436-
437-
438-
439-
440-
441QMarginsF QPageLayout::margins() const-
442{-
443 return
never executed: return d->m_margins;
d->m_margins;
never executed: return d->m_margins;
0
444}-
445-
446-
447-
448-
449-
450-
451-
452QMarginsF QPageLayout::margins(Unit units) const-
453{-
454 return
never executed: return d->margins(units);
d->margins(units);
never executed: return d->margins(units);
0
455}-
456-
457-
458-
459-
460-
461-
462-
463QMargins QPageLayout::marginsPoints() const-
464{-
465 return
never executed: return d->marginsPoints();
d->marginsPoints();
never executed: return d->marginsPoints();
0
466}-
467-
468-
469-
470-
471-
472-
473-
474QMargins QPageLayout::marginsPixels(int resolution) const-
475{-
476 return
never executed: return d->marginsPixels(resolution);
d->marginsPixels(resolution);
never executed: return d->marginsPixels(resolution);
0
477}-
478void QPageLayout::setMinimumMargins(const QMarginsF &minMargins)-
479{-
480 d.detach();-
481 d->setDefaultMargins(minMargins);-
482}
never executed: end of block
0
483-
484-
485-
486-
487-
488-
489-
490QMarginsF QPageLayout::minimumMargins() const-
491{-
492 return
never executed: return d->m_minMargins;
d->m_minMargins;
never executed: return d->m_minMargins;
0
493}-
494QMarginsF QPageLayout::maximumMargins() const-
495{-
496 return
never executed: return d->m_maxMargins;
d->m_maxMargins;
never executed: return d->m_maxMargins;
0
497}-
498QRectF QPageLayout::fullRect() const-
499{-
500 return
never executed: return isValid() ? d->fullRect() : QRect();
isValid() ? d->fullRect() : QRect();
never executed: return isValid() ? d->fullRect() : QRect();
0
501}-
502QRectF QPageLayout::fullRect(Unit units) const-
503{-
504 return
never executed: return isValid() ? d->fullRect(units) : QRect();
isValid() ? d->fullRect(units) : QRect();
never executed: return isValid() ? d->fullRect(units) : QRect();
0
505}-
506QRect QPageLayout::fullRectPoints() const-
507{-
508 return
never executed: return isValid() ? d->fullRectPoints() : QRect();
isValid() ? d->fullRectPoints() : QRect();
never executed: return isValid() ? d->fullRectPoints() : QRect();
0
509}-
510QRect QPageLayout::fullRectPixels(int resolution) const-
511{-
512 return
never executed: return isValid() ? d->fullRectPixels(resolution) : QRect();
isValid() ? d->fullRectPixels(resolution) : QRect();
never executed: return isValid() ? d->fullRectPixels(resolution) : QRect();
0
513}-
514QRectF QPageLayout::paintRect() const-
515{-
516 return
never executed: return isValid() ? d->paintRect() : QRectF();
isValid() ? d->paintRect() : QRectF();
never executed: return isValid() ? d->paintRect() : QRectF();
0
517}-
518QRectF QPageLayout::paintRect(Unit units) const-
519{-
520 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
521 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
522 if (units == d->m_units
units == d->m_unitsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
523 return
never executed: return d->paintRect();
d->paintRect();
never executed: return d->paintRect();
0
524 return
never executed: return d->m_mode == FullPageMode ? d->fullRect(units) : d->fullRect(units) - d->margins(units);
d->m_mode == FullPageMode ? d->fullRect(units)
never executed: return d->m_mode == FullPageMode ? d->fullRect(units) : d->fullRect(units) - d->margins(units);
0
525 : d->fullRect(units) - d->margins(units);
never executed: return d->m_mode == FullPageMode ? d->fullRect(units) : d->fullRect(units) - d->margins(units);
0
526}-
527QRect QPageLayout::paintRectPoints() const-
528{-
529 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
530 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
531 return
never executed: return d->m_mode == FullPageMode ? d->fullRectPoints() : d->fullRectPoints() - d->marginsPoints();
d->m_mode == FullPageMode ? d->fullRectPoints()
never executed: return d->m_mode == FullPageMode ? d->fullRectPoints() : d->fullRectPoints() - d->marginsPoints();
0
532 : d->fullRectPoints() - d->marginsPoints();
never executed: return d->m_mode == FullPageMode ? d->fullRectPoints() : d->fullRectPoints() - d->marginsPoints();
0
533}-
534QRect QPageLayout::paintRectPixels(int resolution) const-
535{-
536 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
537 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
538 return
never executed: return d->m_mode == FullPageMode ? d->fullRectPixels(resolution) : d->fullRectPixels(resolution) - d->marginsPixels(resolution);
d->m_mode == FullPageMode ? d->fullRectPixels(resolution)
never executed: return d->m_mode == FullPageMode ? d->fullRectPixels(resolution) : d->fullRectPixels(resolution) - d->marginsPixels(resolution);
0
539 : d->fullRectPixels(resolution) - d->marginsPixels(resolution);
never executed: return d->m_mode == FullPageMode ? d->fullRectPixels(resolution) : d->fullRectPixels(resolution) - d->marginsPixels(resolution);
0
540}-
541-
542-
543QDebug operator<<(QDebug dbg, const QPageLayout &layout)-
544{-
545 QDebugStateSaver saver(dbg);-
546 dbg.nospace();-
547 dbg.noquote();-
548 dbg << "QPageLayout(";-
549 if (layout.isValid()
layout.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
550 const QMarginsF margins = layout.margins();-
551 dbg << '"' << layout.pageSize().name() << "\", "-
552 << (layout.orientation() == QPageLayout::Portrait ? "Portrait" : "Landscape")-
553 << ", l:" << margins.left() << " r:" << margins.right() << " t:"-
554 << margins.top() << " b:" << margins.bottom() << ' ';-
555 switch (layout.units()) {-
556 case
never executed: case QPageLayout::Millimeter:
QPageLayout::Millimeter:
never executed: case QPageLayout::Millimeter:
0
557 dbg << "mm";-
558 break;
never executed: break;
0
559 case
never executed: case QPageLayout::Point:
QPageLayout::Point:
never executed: case QPageLayout::Point:
0
560 dbg << "pt";-
561 break;
never executed: break;
0
562 case
never executed: case QPageLayout::Inch:
QPageLayout::Inch:
never executed: case QPageLayout::Inch:
0
563 dbg << "in";-
564 break;
never executed: break;
0
565 case
never executed: case QPageLayout::Pica:
QPageLayout::Pica:
never executed: case QPageLayout::Pica:
0
566 dbg << "pc";-
567 break;
never executed: break;
0
568 case
never executed: case QPageLayout::Didot:
QPageLayout::Didot:
never executed: case QPageLayout::Didot:
0
569 dbg << "DD";-
570 break;
never executed: break;
0
571 case
never executed: case QPageLayout::Cicero:
QPageLayout::Cicero:
never executed: case QPageLayout::Cicero:
0
572 dbg << "CC";-
573 break;
never executed: break;
0
574 }-
575 }
never executed: end of block
0
576 dbg << ')';-
577 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
578}-
579-
580-
581-
Switch to Source codePreprocessed file

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