| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QSTATICTEXT_H |
| 5 | #define QSTATICTEXT_H |
| 6 | |
| 7 | #include <QtGui/qtguiglobal.h> |
| 8 | #include <QtCore/qsize.h> |
| 9 | #include <QtCore/qstring.h> |
| 10 | #include <QtCore/qmetatype.h> |
| 11 | |
| 12 | #include <QtGui/qtransform.h> |
| 13 | #include <QtGui/qfont.h> |
| 14 | #include <QtGui/qtextoption.h> |
| 15 | |
| 16 | QT_BEGIN_NAMESPACE |
| 17 | |
| 18 | |
| 19 | class QStaticTextPrivate; |
| 20 | class Q_GUI_EXPORT QStaticText |
| 21 | { |
| 22 | public: |
| 23 | enum PerformanceHint { |
| 24 | ModerateCaching, |
| 25 | AggressiveCaching |
| 26 | }; |
| 27 | |
| 28 | QStaticText(); |
| 29 | explicit QStaticText(const QString &text); |
| 30 | QStaticText(const QStaticText &other); |
| 31 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStaticText) |
| 32 | QStaticText &operator=(const QStaticText &); |
| 33 | ~QStaticText(); |
| 34 | |
| 35 | void swap(QStaticText &other) noexcept { data.swap(other&: other.data); } |
| 36 | |
| 37 | void setText(const QString &text); |
| 38 | QString text() const; |
| 39 | |
| 40 | void setTextFormat(Qt::TextFormat textFormat); |
| 41 | Qt::TextFormat textFormat() const; |
| 42 | |
| 43 | void setTextWidth(qreal textWidth); |
| 44 | qreal textWidth() const; |
| 45 | |
| 46 | void setTextOption(const QTextOption &textOption); |
| 47 | QTextOption textOption() const; |
| 48 | |
| 49 | QSizeF size() const; |
| 50 | |
| 51 | void prepare(const QTransform &matrix = QTransform(), const QFont &font = QFont()); |
| 52 | |
| 53 | void setPerformanceHint(PerformanceHint performanceHint); |
| 54 | PerformanceHint performanceHint() const; |
| 55 | |
| 56 | bool operator==(const QStaticText &) const; |
| 57 | bool operator!=(const QStaticText &) const; |
| 58 | |
| 59 | private: |
| 60 | void detach(); |
| 61 | |
| 62 | QExplicitlySharedDataPointer<QStaticTextPrivate> data; |
| 63 | friend class QStaticTextPrivate; |
| 64 | }; |
| 65 | |
| 66 | Q_DECLARE_SHARED(QStaticText) |
| 67 | |
| 68 | QT_END_NAMESPACE |
| 69 | |
| 70 | QT_DECL_METATYPE_EXTERN(QStaticText, Q_GUI_EXPORT) |
| 71 | |
| 72 | #endif // QSTATICTEXT_H |
| 73 |
