| 1 | // Copyright (C) 2017 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 QQUICKTEXTAREA_P_P_H |
| 5 | #define QQUICKTEXTAREA_P_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtQml/private/qlazilyallocated_p.h> |
| 19 | #include <QtQuick/private/qquicktextedit_p_p.h> |
| 20 | #include <QtQuick/private/qquickitemchangelistener_p.h> |
| 21 | #include <QtQuickTemplates2/private/qquickpresshandler_p_p.h> |
| 22 | #include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h> |
| 23 | #include <QtQuickTemplates2/private/qquicktheme_p.h> |
| 24 | |
| 25 | #include <QtQuickTemplates2/private/qquicktextarea_p.h> |
| 26 | |
| 27 | QT_BEGIN_NAMESPACE |
| 28 | |
| 29 | class QQuickFlickable; |
| 30 | |
| 31 | class QQuickTextAreaPrivate : public QQuickTextEditPrivate, public QQuickItemChangeListener |
| 32 | { |
| 33 | public: |
| 34 | Q_DECLARE_PUBLIC(QQuickTextArea) |
| 35 | |
| 36 | QQuickTextAreaPrivate(); |
| 37 | ~QQuickTextAreaPrivate(); |
| 38 | |
| 39 | static QQuickTextAreaPrivate *get(QQuickTextArea *item) |
| 40 | { |
| 41 | return static_cast<QQuickTextAreaPrivate *>(QObjectPrivate::get(o: item)); |
| 42 | } |
| 43 | |
| 44 | inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); } |
| 45 | inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; } |
| 46 | inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; } |
| 47 | inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; } |
| 48 | inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; } |
| 49 | |
| 50 | void setTopInset(qreal value, bool reset = false); |
| 51 | void setLeftInset(qreal value, bool reset = false); |
| 52 | void setRightInset(qreal value, bool reset = false); |
| 53 | void setBottomInset(qreal value, bool reset = false); |
| 54 | |
| 55 | void resizeBackground(); |
| 56 | |
| 57 | void resolveFont(); |
| 58 | void inheritFont(const QFont &font); |
| 59 | void updateFont(const QFont &font); |
| 60 | inline void setFont_helper(const QFont &font) { |
| 61 | if (sourceFont.resolveMask() == font.resolveMask() && sourceFont == font) |
| 62 | return; |
| 63 | updateFont(font); |
| 64 | } |
| 65 | |
| 66 | #if QT_CONFIG(quicktemplates2_hover) |
| 67 | void updateHoverEnabled(bool h, bool e); |
| 68 | #endif |
| 69 | |
| 70 | void attachFlickable(QQuickFlickable *flickable); |
| 71 | void detachFlickable(); |
| 72 | void ensureCursorVisible(); |
| 73 | void resizeFlickableControl(); |
| 74 | void resizeFlickableContent(); |
| 75 | |
| 76 | void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override; |
| 77 | |
| 78 | qreal getImplicitWidth() const override; |
| 79 | qreal getImplicitHeight() const override; |
| 80 | |
| 81 | void implicitWidthChanged() override; |
| 82 | void implicitHeightChanged() override; |
| 83 | |
| 84 | void readOnlyChanged(bool isReadOnly); |
| 85 | |
| 86 | #if QT_CONFIG(accessibility) |
| 87 | void accessibilityActiveChanged(bool active) override; |
| 88 | #endif |
| 89 | |
| 90 | void cancelBackground(); |
| 91 | void executeBackground(bool complete = false); |
| 92 | |
| 93 | void itemImplicitWidthChanged(QQuickItem *item) override; |
| 94 | void itemImplicitHeightChanged(QQuickItem *item) override; |
| 95 | void itemDestroyed(QQuickItem *item) override; |
| 96 | |
| 97 | QPalette defaultPalette() const override; |
| 98 | |
| 99 | bool setLastFocusChangeReason(Qt::FocusReason reason) override; |
| 100 | |
| 101 | #if QT_CONFIG(quicktemplates2_hover) |
| 102 | bool hovered = false; |
| 103 | bool explicitHoverEnabled = false; |
| 104 | #endif |
| 105 | |
| 106 | struct { |
| 107 | bool = false; |
| 108 | bool = false; |
| 109 | bool = false; |
| 110 | bool = false; |
| 111 | bool = false; |
| 112 | bool = false; |
| 113 | qreal = 0; |
| 114 | qreal = 0; |
| 115 | qreal = 0; |
| 116 | qreal = 0; |
| 117 | QFont ; |
| 118 | QPalette ; |
| 119 | }; |
| 120 | QLazilyAllocated<ExtraData> ; |
| 121 | |
| 122 | bool resizingBackground = false; |
| 123 | QPalette resolvedPalette; |
| 124 | QQuickDeferredPointer<QQuickItem> background; |
| 125 | QString placeholder; |
| 126 | QColor placeholderColor; |
| 127 | QQuickPressHandler pressHandler; |
| 128 | QQuickFlickable *flickable = nullptr; |
| 129 | }; |
| 130 | |
| 131 | QT_END_NAMESPACE |
| 132 | |
| 133 | #endif // QQUICKTEXTAREA_P_P_H |
| 134 | |