Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickstyledtext_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 QQUICKSTYLEDTEXT_H
6#define QQUICKSTYLEDTEXT_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 <QSize>
20#include <QPointF>
21#include <QList>
22#include <QUrl>
23#include <QScopedPointer>
24#include <QtQuick/private/qquickpixmap_p.h>
25
27
28class QQuickStyledTextImgTag;
30class QString;
31class QQmlContext;
32
33class Q_AUTOTEST_EXPORT QQuickStyledTextImgTag
34{
35public:
36 QQuickStyledTextImgTag() = default;
37 ~QQuickStyledTextImgTag() = default;
38
39 enum Align {
40 Bottom,
41 Middle,
42 Top
43 };
44
45 QUrl url;
46 QPointF pos;
47 QSize size;
48 int position = 0;
49 qreal offset = 0.0; // this offset allows us to compensate for flooring reserved space
50 Align align = QQuickStyledTextImgTag::Bottom;
51 QScopedPointer<QQuickPixmap> pix;
52};
53
54class Q_AUTOTEST_EXPORT QQuickStyledText
55{
56public:
57 static void parse(const QString &string, QTextLayout &layout,
58 QList<QQuickStyledTextImgTag*> &imgTags,
59 const QUrl &baseUrl,
60 QQmlContext *context,
61 bool preloadImages,
62 bool *fontSizeModified);
63
64private:
65 QQuickStyledText(const QString &string, QTextLayout &layout,
66 QList<QQuickStyledTextImgTag*> &imgTags,
67 const QUrl &baseUrl,
68 QQmlContext *context,
69 bool preloadImages,
70 bool *fontSizeModified);
71 ~QQuickStyledText();
72
73 QQuickStyledTextPrivate *d;
74};
75
76QT_END_NAMESPACE
77
78#endif
QList< QQuickStyledTextImgTag * > * imgTags
bool parseCloseTag(const QChar *&ch, const QString &textIn, QString &textOut)
static const QChar singleQuote
void parseImageAttributes(const QChar *&ch, const QString &textIn, QString &textOut)
static const QChar lessThan
void setFontSize(int size, QTextCharFormat &format)
bool parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format)
bool parseAnchorAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format)
static const QChar ampersand
static const QChar greaterThan
std::pair< QStringView, QStringView > parseAttribute(const QChar *&ch, const QString &textIn)
void parseEntity(const QChar *&ch, const QString &textIn, QString &textOut)
static const QChar doubleQuote
static const QChar lineFeed
QStringView parseValue(const QChar *&ch, const QString &textIn)
static QString toRoman(int value, bool upper)
bool parseFontAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format)
bool parseOrderedListAttributes(const QChar *&ch, const QString &textIn)
void appendText(const QString &textIn, int start, int length, QString &textOut)
void skipSpace(const QChar *&ch)
QQuickStyledTextPrivate(const QString &t, QTextLayout &l, QList< QQuickStyledTextImgTag * > &imgTags, const QUrl &baseUrl, QQmlContext *context, bool preloadImages, bool *fontSizeModified)
static QString toAlpha(int value, bool upper)
bool parseUnorderedListAttributes(const QChar *&ch, const QString &textIn)
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")