Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktextedit_p_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
4 | ** Contact: https://www.qt.io/licensing/ | - |
5 | ** | - |
6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 3 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
24 | ** | - |
25 | ** GNU General Public License Usage | - |
26 | ** Alternatively, this file may be used under the terms of the GNU | - |
27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
28 | ** Public license version 3 or any later version approved by the KDE Free | - |
29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
31 | ** included in the packaging of this file. Please review the following | - |
32 | ** information to ensure the GNU General Public License requirements will | - |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
35 | ** | - |
36 | ** $QT_END_LICENSE$ | - |
37 | ** | - |
38 | ****************************************************************************/ | - |
39 | - | |
40 | #ifndef QQUICKTEXTEDIT_P_P_H | - |
41 | #define QQUICKTEXTEDIT_P_P_H | - |
42 | - | |
43 | // | - |
44 | // W A R N I N G | - |
45 | // ------------- | - |
46 | // | - |
47 | // This file is not part of the Qt API. It exists purely as an | - |
48 | // implementation detail. This header file may change from version to | - |
49 | // version without notice, or even be removed. | - |
50 | // | - |
51 | // We mean it. | - |
52 | // | - |
53 | - | |
54 | #include "qquicktextedit_p.h" | - |
55 | #include "qquickimplicitsizeitem_p_p.h" | - |
56 | #include "qquicktextutil_p.h" | - |
57 | - | |
58 | #include <QtQml/qqml.h> | - |
59 | #include <QtCore/qlist.h> | - |
60 | #include <private/qlazilyallocated_p.h> | - |
61 | - | |
62 | #include <limits> | - |
63 | - | |
64 | QT_BEGIN_NAMESPACE | - |
65 | class QTextLayout; | - |
66 | class QQuickTextDocumentWithImageResources; | - |
67 | class QQuickTextControl; | - |
68 | class QQuickTextNode; | - |
69 | class QQuickTextNodeEngine; | - |
70 | - | |
71 | class Q_QUICK_PRIVATE_EXPORT QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate | - |
72 | { | - |
73 | public: | - |
74 | Q_DECLARE_PUBLIC(QQuickTextEdit) | - |
75 | - | |
76 | typedef QQuickTextEdit Public; | - |
77 | - | |
78 | struct Node { | - |
79 | explicit Node(int startPos = std::numeric_limits<int>::max(), | - |
80 | QQuickTextNode *node = nullptr) | - |
81 | : m_startPos(startPos), m_node(node), m_dirty(false) { } executed 7410 times by 5 tests: end of block Executed by:
| 7410 |
82 | QQuickTextNode* textNode() const { return m_node; } executed 758 times by 4 tests: return m_node; Executed by:
| 758 |
83 | void moveStartPos(int delta) { Q_ASSERT(m_startPos + delta > 0); m_startPos += delta; } executed 6 times by 1 test: end of block Executed by:
| 6 |
84 | int startPos() const { return m_startPos; } executed 16696 times by 4 tests: return m_startPos; Executed by:
| 16696 |
85 | void setDirty() { m_dirty = true; } executed 2696 times by 1 test: end of block Executed by:
| 2696 |
86 | bool dirty() const { return m_dirty; } executed 354 times by 2 tests: return m_dirty; Executed by:
| 354 |
87 | - | |
88 | private: | - |
89 | int m_startPos; | - |
90 | QQuickTextNode* m_node; | - |
91 | bool m_dirty; | - |
92 | }; | - |
93 | typedef QList<Node>::iterator TextNodeIterator; | - |
94 | - | |
95 | struct ExtraData { | - |
96 | ExtraData(); | - |
97 | - | |
98 | qreal padding; | - |
99 | qreal topPadding; | - |
100 | qreal leftPadding; | - |
101 | qreal rightPadding; | - |
102 | qreal bottomPadding; | - |
103 | bool explicitTopPadding : 1; | - |
104 | bool explicitLeftPadding : 1; | - |
105 | bool explicitRightPadding : 1; | - |
106 | bool explicitBottomPadding : 1; | - |
107 | bool implicitResize : 1; | - |
108 | }; | - |
109 | QLazilyAllocated<ExtraData> extra; | - |
110 | - | |
111 | - | |
112 | QQuickTextEditPrivate() | - |
113 | : color(QRgb(0xFF000000)), selectionColor(QRgb(0xFF000080)), selectedTextColor(QRgb(0xFFFFFFFF)) | - |
114 | , textMargin(0.0), xoff(0), yoff(0) | - |
115 | , font(sourceFont), cursorComponent(nullptr), cursorItem(nullptr), document(nullptr), control(nullptr) | - |
116 | , quickDocument(nullptr), lastSelectionStart(0), lastSelectionEnd(0), lineCount(0) | - |
117 | , hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop) | - |
118 | , format(QQuickTextEdit::PlainText), wrapMode(QQuickTextEdit::NoWrap) | - |
119 | , renderType(QQuickTextUtil::textRenderType<QQuickTextEdit>()) | - |
120 | , contentDirection(Qt::LayoutDirectionAuto) | - |
121 | , mouseSelectionMode(QQuickTextEdit::SelectCharacters) | - |
122 | #if QT_CONFIG(im) | - |
123 | , inputMethodHints(Qt::ImhNone) | - |
124 | #endif | - |
125 | , updateType(UpdatePaintNode) | - |
126 | , dirty(false), richText(false), cursorVisible(false), cursorPending(false) | - |
127 | , focusOnPress(true), persistentSelection(false), requireImplicitWidth(false) | - |
128 | , selectByMouse(false), canPaste(false), canPasteValid(false), hAlignImplicit(true) | - |
129 | , textCached(true), inLayout(false), selectByKeyboard(false), selectByKeyboardSet(false) | - |
130 | , hadSelection(false) | - |
131 | { | - |
132 | } executed 1076 times by 6 tests: end of block Executed by:
| 1076 |
133 | - | |
134 | static QQuickTextEditPrivate *get(QQuickTextEdit *item) { | - |
135 | return static_cast<QQuickTextEditPrivate *>(QObjectPrivate::get(item)); } executed 66 times by 1 test: return static_cast<QQuickTextEditPrivate *>(QObjectPrivate::get(item)); Executed by:
| 66 |
136 | - | |
137 | void init(); | - |
138 | - | |
139 | void resetInputMethod(); | - |
140 | void updateDefaultTextOption(); | - |
141 | void relayoutDocument(); | - |
142 | bool determineHorizontalAlignment(); | - |
143 | bool setHAlign(QQuickTextEdit::HAlignment, bool forceAlign = false); | - |
144 | void mirrorChange() override; | - |
145 | qreal getImplicitWidth() const override; | - |
146 | Qt::LayoutDirection textDirection(const QString &text) const; | - |
147 | bool isLinkHoveredConnected(); | - |
148 | - | |
149 | void setNativeCursorEnabled(bool) {} | - |
150 | void handleFocusEvent(QFocusEvent *event); | - |
151 | void addCurrentTextNodeToRoot(QQuickTextNodeEngine *, QSGTransformNode *, QQuickTextNode*, TextNodeIterator&, int startPos); | - |
152 | QQuickTextNode* createTextNode(); | - |
153 | - | |
154 | #if QT_CONFIG(im) | - |
155 | Qt::InputMethodHints effectiveInputMethodHints() const; | - |
156 | #endif | - |
157 | - | |
158 | inline qreal padding() const { return extra.isAllocated() ? extra->padding : 0.0; } executed 61284 times by 6 tests: return extra.isAllocated() ? extra->padding : 0.0; Executed by:
| 61284 |
159 | void setTopPadding(qreal value, bool reset = false); | - |
160 | void setLeftPadding(qreal value, bool reset = false); | - |
161 | void setRightPadding(qreal value, bool reset = false); | - |
162 | void setBottomPadding(qreal value, bool reset = false); | - |
163 | - | |
164 | bool isImplicitResizeEnabled() const; | - |
165 | void setImplicitResizeEnabled(bool enabled); | - |
166 | - | |
167 | QColor color; | - |
168 | QColor selectionColor; | - |
169 | QColor selectedTextColor; | - |
170 | - | |
171 | QSizeF contentSize; | - |
172 | - | |
173 | qreal textMargin; | - |
174 | qreal xoff; | - |
175 | qreal yoff; | - |
176 | - | |
177 | QString text; | - |
178 | QUrl baseUrl; | - |
179 | QFont sourceFont; | - |
180 | QFont font; | - |
181 | - | |
182 | QQmlComponent* cursorComponent; | - |
183 | QQuickItem* cursorItem; | - |
184 | QQuickTextDocumentWithImageResources *document; | - |
185 | QQuickTextControl *control; | - |
186 | QQuickTextDocument *quickDocument; | - |
187 | QList<Node> textNodeMap; | - |
188 | - | |
189 | int lastSelectionStart; | - |
190 | int lastSelectionEnd; | - |
191 | int lineCount; | - |
192 | - | |
193 | enum UpdateType { | - |
194 | UpdateNone, | - |
195 | UpdateOnlyPreprocess, | - |
196 | UpdatePaintNode | - |
197 | }; | - |
198 | - | |
199 | QQuickTextEdit::HAlignment hAlign; | - |
200 | QQuickTextEdit::VAlignment vAlign; | - |
201 | QQuickTextEdit::TextFormat format; | - |
202 | QQuickTextEdit::WrapMode wrapMode; | - |
203 | QQuickTextEdit::RenderType renderType; | - |
204 | Qt::LayoutDirection contentDirection; | - |
205 | QQuickTextEdit::SelectionMode mouseSelectionMode; | - |
206 | #if QT_CONFIG(im) | - |
207 | Qt::InputMethodHints inputMethodHints; | - |
208 | #endif | - |
209 | UpdateType updateType; | - |
210 | - | |
211 | bool dirty : 1; | - |
212 | bool richText : 1; | - |
213 | bool cursorVisible : 1; | - |
214 | bool cursorPending : 1; | - |
215 | bool focusOnPress : 1; | - |
216 | bool persistentSelection : 1; | - |
217 | bool requireImplicitWidth:1; | - |
218 | bool selectByMouse:1; | - |
219 | bool canPaste:1; | - |
220 | bool canPasteValid:1; | - |
221 | bool hAlignImplicit:1; | - |
222 | bool textCached:1; | - |
223 | bool inLayout:1; | - |
224 | bool selectByKeyboard:1; | - |
225 | bool selectByKeyboardSet:1; | - |
226 | bool hadSelection : 1; | - |
227 | }; | - |
228 | - | |
229 | QT_END_NAMESPACE | - |
230 | - | |
231 | #endif // QQUICKTEXTEDIT_P_P_H | - |
Source code | Switch to Preprocessed file |