Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtextformat_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
4#ifndef QTEXTFORMAT_P_H
5#define QTEXTFORMAT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include "QtGui/qtextformat.h"
20#include "QtCore/qlist.h"
21#include <QtCore/qhash.h> // QMultiHash
22
24
25class Q_GUI_EXPORT QTextFormatCollection
26{
27public:
30
31 void clear();
32
33 inline QTextFormat objectFormat(int objectIndex) const
34 { return format(objectFormatIndex(objectIndex)); }
35 inline void setObjectFormat(int objectIndex, const QTextFormat &format)
36 { setObjectFormatIndex(objectIndex, indexForFormat(format)); }
37
38 int objectFormatIndex(int objectIndex) const;
39 void setObjectFormatIndex(int objectIndex, int formatIndex);
40
41 int createObjectIndex(const QTextFormat &f);
42
43 int indexForFormat(const QTextFormat &f);
44 bool hasFormatCached(const QTextFormat &format) const;
45
46 QTextFormat format(int idx) const;
48 { return format(index).toBlockFormat(); }
50 { return format(index).toCharFormat(); }
52 { return format(index).toListFormat(); }
54 { return format(index).toTableFormat(); }
56 { return format(index).toImageFormat(); }
57
58 inline int numFormats() const { return formats.size(); }
59
60 typedef QList<QTextFormat> FormatVector;
61
63 QList<qint32> objFormats;
64 QMultiHash<size_t,int> hashes;
65
66 inline QFont defaultFont() const { return defaultFnt; }
67 void setDefaultFont(const QFont &f);
68
69 inline void setSuperScriptBaseline(qreal baseline) { defaultFormat.setSuperScriptBaseline(baseline); }
70 inline void setSubScriptBaseline(qreal baseline) { defaultFormat.setSubScriptBaseline(baseline); }
71 inline void setBaselineOffset(qreal baseline) { defaultFormat.setBaselineOffset(baseline); }
72
73 inline QTextCharFormat defaultTextFormat() const { return defaultFormat; }
74
75private:
76 QFont defaultFnt;
77 QTextCharFormat defaultFormat;
78
79 Q_DISABLE_COPY_MOVE(QTextFormatCollection)
80};
81
83
84#endif // QTEXTFORMAT_P_H
\reentrant
Definition qfont.h:22
void setSuperScriptBaseline(qreal baseline)
QMultiHash< size_t, int > hashes
void setBaselineOffset(qreal baseline)
QTextListFormat listFormat(int index) const
QList< qint32 > objFormats
QTextCharFormat defaultTextFormat() const
QFont defaultFont() const
QTextFormat objectFormat(int objectIndex) const
QTextImageFormat imageFormat(int index) const
QTextTableFormat tableFormat(int index) const
QTextBlockFormat blockFormat(int index) const
void setObjectFormat(int objectIndex, const QTextFormat &format)
QTextCharFormat charFormat(int index) const
void setSubScriptBaseline(qreal baseline)
QList< QTextFormat > FormatVector
\reentrant
Definition qtextformat.h:90
QTextCharFormat toCharFormat() const
Returns this format as a character format.
QTextBlockFormat toBlockFormat() const
Returns this format as a block format.
QTextTableFormat toTableFormat() const
Returns this format as a table format.
QTextImageFormat toImageFormat() const
Returns this format as an image format.
QTextListFormat toListFormat() const
Returns this format as a list format.
b clear()
EGLint EGLint * formats
Combined button and popup list for selecting options.
GLuint index
[2]
GLfloat GLfloat f
GLint GLsizei GLsizei GLenum format
double qreal
Definition qtypes.h:187