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 // Horizontal margin (in pixels) added on each side of an inline image
46 // to provide visual spacing between the image and adjacent text/images.
47 static constexpr qreal HMargin = 1.0;
48
49 QUrl url;
50 QPointF pos;
51 QSize size;
52 int position = 0;
53 Align align = QQuickStyledTextImgTag::Bottom;
54 QScopedPointer<QQuickPixmap> pix;
55};
56
57class Q_AUTOTEST_EXPORT QQuickStyledText
58{
59public:
60 static void parse(const QString &string, QTextLayout &layout,
61 QList<QQuickStyledTextImgTag*> &imgTags,
62 const QUrl &baseUrl,
63 QQmlContext *context,
64 bool preloadImages,
65 bool *fontSizeModified);
66
67private:
68 QQuickStyledText(const QString &string, QTextLayout &layout,
69 QList<QQuickStyledTextImgTag*> &imgTags,
70 const QUrl &baseUrl,
71 QQmlContext *context,
72 bool preloadImages,
73 bool *fontSizeModified);
74 ~QQuickStyledText();
75
76 QQuickStyledTextPrivate *d;
77};
78
79QT_END_NAMESPACE
80
81#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)
Combined button and popup list for selecting options.
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
#define QQUICKSTYLEDPARSER_COORD_LIMIT