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
27QT_BEGIN_NAMESPACE
28
29class QQuickFlickable;
30
31class QQuickTextAreaPrivate : public QQuickTextEditPrivate, public QQuickItemChangeListener
32{
33public:
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 ExtraData {
107 bool hasTopInset = false;
108 bool hasLeftInset = false;
109 bool hasRightInset = false;
110 bool hasBottomInset = false;
111 bool hasBackgroundWidth = false;
112 bool hasBackgroundHeight = false;
113 qreal topInset = 0;
114 qreal leftInset = 0;
115 qreal rightInset = 0;
116 qreal bottomInset = 0;
117 QFont requestedFont;
118 QPalette requestedPalette;
119 };
120 QLazilyAllocated<ExtraData> extra;
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
131QT_END_NAMESPACE
132
133#endif // QQUICKTEXTAREA_P_P_H
134

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtdeclarative/src/quicktemplates/qquicktextarea_p_p.h