Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtGui/qpagelayout.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2014 John Layt <jlayt@kde.org>
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QPAGELAYOUT_H
0005 #define QPAGELAYOUT_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qshareddata.h>
0009 #include <QtCore/qstring.h>
0010 #include <QtCore/qmargins.h>
0011 
0012 #include <QtGui/qpagesize.h>
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 class QPageLayoutPrivate;
0017 class QMarginsF;
0018 
0019 class Q_GUI_EXPORT QPageLayout
0020 {
0021 public:
0022 
0023     // NOTE: Must keep in sync with QPageSize::Unit and QPrinter::Unit
0024     enum Unit {
0025         Millimeter,
0026         Point,
0027         Inch,
0028         Pica,
0029         Didot,
0030         Cicero
0031     };
0032 
0033     enum Orientation {
0034         Portrait,
0035         Landscape
0036     };
0037 
0038     enum Mode {
0039         StandardMode,  // Paint Rect includes margins
0040         FullPageMode   // Paint Rect excludes margins
0041     };
0042 
0043     QPageLayout();
0044     QPageLayout(const QPageSize &pageSize, Orientation orientation,
0045                 const QMarginsF &margins, Unit units = Point,
0046                 const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0));
0047     QPageLayout(const QPageLayout &other);
0048     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageLayout)
0049     QPageLayout &operator=(const QPageLayout &other);
0050     ~QPageLayout();
0051 
0052     void swap(QPageLayout &other) noexcept { d.swap(other.d); }
0053 
0054     bool isEquivalentTo(const QPageLayout &other) const;
0055 
0056     bool isValid() const;
0057 
0058     void setMode(Mode mode);
0059     Mode mode() const;
0060 
0061     void setPageSize(const QPageSize &pageSize,
0062                      const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0));
0063     QPageSize pageSize() const;
0064 
0065     void setOrientation(Orientation orientation);
0066     Orientation orientation() const;
0067 
0068     void setUnits(Unit units);
0069     Unit units() const;
0070 
0071     bool setMargins(const QMarginsF &margins);
0072     bool setLeftMargin(qreal leftMargin);
0073     bool setRightMargin(qreal rightMargin);
0074     bool setTopMargin(qreal topMargin);
0075     bool setBottomMargin(qreal bottomMargin);
0076 
0077     QMarginsF margins() const;
0078     QMarginsF margins(Unit units) const;
0079     QMargins marginsPoints() const;
0080     QMargins marginsPixels(int resolution) const;
0081 
0082     void setMinimumMargins(const QMarginsF &minMargins);
0083     QMarginsF minimumMargins() const;
0084     QMarginsF maximumMargins() const;
0085 
0086     QRectF fullRect() const;
0087     QRectF fullRect(Unit units) const;
0088     QRect fullRectPoints() const;
0089     QRect fullRectPixels(int resolution) const;
0090 
0091     QRectF paintRect() const;
0092     QRectF paintRect(Unit units) const;
0093     QRect paintRectPoints() const;
0094     QRect paintRectPixels(int resolution) const;
0095 
0096 private:
0097     friend class QPageLayoutPrivate;
0098     bool equals(const QPageLayout &other) const;
0099 
0100     friend inline bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)
0101     { return lhs.equals(rhs); }
0102     friend inline bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
0103     { return !lhs.equals(rhs); }
0104 
0105     QExplicitlySharedDataPointer<QPageLayoutPrivate> d;
0106 };
0107 
0108 Q_DECLARE_SHARED(QPageLayout)
0109 
0110 #ifndef QT_NO_DEBUG_STREAM
0111 Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageLayout &pageLayout);
0112 #endif
0113 
0114 QT_END_NAMESPACE
0115 
0116 QT_DECL_METATYPE_EXTERN(QPageLayout, Q_GUI_EXPORT)
0117 QT_DECL_METATYPE_EXTERN_TAGGED(QPageLayout::Unit, QPageLayout__Unit, Q_GUI_EXPORT)
0118 QT_DECL_METATYPE_EXTERN_TAGGED(QPageLayout::Orientation, QPageLayout__Orientation, Q_GUI_EXPORT)
0119 
0120 #endif // QPAGELAYOUT_H