27class QQuickTextUtil :
public QObject
31 template <
typename Private>
static void setCursorDelegate(Private *d, QQmlComponent *delegate);
32 template <
typename Private>
static void createCursor(Private *d);
34 template <
typename T>
static typename T::RenderType textRenderType();
36 static qreal alignedX(qreal textWidth, qreal itemWidth,
int alignment);
37 static qreal alignedY(qreal textHeight, qreal itemHeight,
int alignment);
40 static QQuickItem *createCursor(
41 QQmlComponent *component,
43 const QRectF &cursorRectangle,
44 const char *className);
49void QQuickTextUtil::setCursorDelegate(Private *d, QQmlComponent *delegate)
51 if (d->cursorComponent == delegate)
54 typename Private::Public *parent = d->q_func();
56 if (d->cursorComponent) {
57 disconnect(d->cursorComponent, SIGNAL(statusChanged(QQmlComponent::Status)),
58 parent, SLOT(createCursor()));
63 d->cursorPending =
true;
65 d->cursorComponent = delegate;
67 if (parent->isCursorVisible() && parent->isComponentComplete())
70 Q_EMIT parent->cursorDelegateChanged();
74void QQuickTextUtil::createCursor(Private *d)
76 if (!d->cursorPending)
79 d->cursorPending =
false;
81 typename Private::Public *parent = d->q_func();
82 if (d->cursorComponent) {
83 d->cursorItem = createCursor(
86 parent->cursorRectangle(),
87 Private::Public::staticMetaObject.className());
90 d->setNativeCursorEnabled(!d->cursorItem);
91 d->updateType = Private::UpdatePaintNode;
96typename T::RenderType QQuickTextUtil::textRenderType()
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;
107 Q_UNREACHABLE_RETURN(T::QtRendering);
The QSGTextNode class is a class for drawing text layouts and text documents in the Qt Quick scene gr...
#define QQUICKTEXT_LARGETEXT_THRESHOLD
static void getLinks_helper(const QTextLayout *layout, QVector< QQuickTextPrivate::LinkDesc > *links)