Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquicktextutil_p.h
Go to the documentation of this file.
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QQUICKTEXTUTIL_P_H
6
#
define
QQUICKTEXTUTIL_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtQml
/
qqmlincubator
.
h
>
20
#
include
<
QtQuick
/
qquickitem
.
h
>
21
#
include
<
QtQuick
/
qquickwindow
.
h
>
22
#
include
<
QtCore
/
private
/
qglobal_p
.
h
>
23
#
include
<
QtQml
/
qqmlcomponent
.
h
>
24
25
QT_BEGIN_NAMESPACE
26
27
class
QQuickTextUtil :
public
QObject
// For the benefit of translations.
28
{
29
Q_OBJECT
30
public
:
31
template
<
typename
Private>
static
void
setCursorDelegate(Private *d, QQmlComponent *delegate);
32
template
<
typename
Private>
static
void
createCursor(Private *d);
33
34
template
<
typename
T>
static
typename
T::RenderType textRenderType();
35
36
static
qreal alignedX(qreal textWidth, qreal itemWidth,
int
alignment);
37
static
qreal alignedY(qreal textHeight, qreal itemHeight,
int
alignment);
38
39
private
:
40
static
QQuickItem *createCursor(
41
QQmlComponent *component,
42
QQuickItem *parent,
43
const
QRectF &cursorRectangle,
44
const
char
*className);
45
46
};
47
48
template
<
typename
Private>
49
void
QQuickTextUtil::setCursorDelegate(Private *d, QQmlComponent *delegate)
50
{
51
if
(d->cursorComponent == delegate)
52
return
;
53
54
typename
Private::Public *parent = d->q_func();
55
56
if
(d->cursorComponent) {
57
disconnect(d->cursorComponent, SIGNAL(statusChanged(QQmlComponent::Status)),
58
parent, SLOT(createCursor()));
59
}
60
61
delete
d->cursorItem;
62
d->cursorItem = 0;
63
d->cursorPending =
true
;
64
65
d->cursorComponent = delegate;
66
67
if
(parent->isCursorVisible() && parent->isComponentComplete())
68
createCursor(d);
69
70
Q_EMIT parent->cursorDelegateChanged();
71
}
72
73
template
<
typename
Private>
74
void
QQuickTextUtil::createCursor(Private *d)
75
{
76
if
(!d->cursorPending)
77
return
;
78
79
d->cursorPending =
false
;
80
81
typename
Private::Public *parent = d->q_func();
82
if
(d->cursorComponent) {
83
d->cursorItem = createCursor(
84
d->cursorComponent,
85
parent,
86
parent->cursorRectangle(),
87
Private::Public::staticMetaObject.className());
88
}
89
90
d->setNativeCursorEnabled(!d->cursorItem);
91
d->updateType = Private::UpdatePaintNode;
92
parent->update();
93
}
94
95
template
<
typename
T>
96
typename
T::RenderType QQuickTextUtil::textRenderType()
97
{
98
switch
(QQuickWindow::textRenderType()) {
99
case
QQuickWindow::QtTextRendering:
100
return
T::QtRendering;
101
case
QQuickWindow::NativeTextRendering:
102
return
T::NativeRendering;
103
case
QQuickWindow::CurveTextRendering:
104
return
T::CurveRendering;
105
}
106
107
Q_UNREACHABLE_RETURN(T::QtRendering);
108
}
109
110
QT_END_NAMESPACE
111
112
#
endif
QQuickTextNodeEngine
Definition
qquicktextnodeengine_p.h:37
QQuickTextPrivate
Definition
qquicktext_p_p.h:34
QSGInternalTextNode
\inmodule QtQuick
Definition
qsginternaltextnode_p.h:46
QSGTextNode
The QSGTextNode class is a class for drawing text layouts and text documents in the Qt Quick scene gr...
Definition
qsgtextnode.h:14
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
Q_STATIC_LOGGING_CATEGORY
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
QQUICKTEXT_LARGETEXT_THRESHOLD
#define QQUICKTEXT_LARGETEXT_THRESHOLD
Definition
qquicktext.cpp:45
positionInlineImage
static void positionInlineImage(QQuickStyledTextImgTag *image, int textPos, const QTextLine &line)
Definition
qquicktext.cpp:733
getLinks_helper
static void getLinks_helper(const QTextLayout *layout, QList< QQuickTextPrivate::LinkDesc > *links)
Definition
qquicktext.cpp:3067
qtdeclarative
src
quick
items
qquicktextutil_p.h
Generated on
for Qt by
1.18.0