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
qtextoption.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
QTEXTOPTION_H
5
#
define
QTEXTOPTION_H
6
7
#
include
<
QtGui
/
qtguiglobal
.
h
>
8
#
include
<
QtCore
/
qnamespace
.
h
>
9
#
include
<
QtCore
/
qchar
.
h
>
10
#
include
<
QtCore
/
qmetatype
.
h
>
11
12
13
QT_BEGIN_NAMESPACE
14
15
struct
QTextOptionPrivate;
16
17
class
Q_GUI_EXPORT
QTextOption
18
{
19
public
:
20
enum
TabType {
21
LeftTab,
22
RightTab,
23
CenterTab,
24
DelimiterTab
25
};
26
27
struct
Q_GUI_EXPORT Tab {
28
inline
Tab() : position(80), type(QTextOption::LeftTab) { }
29
inline
Tab(qreal pos, TabType tabType, QChar delim = QChar())
30
: position(pos), type(tabType), delimiter(delim) {}
31
32
inline
bool
operator==(
const
Tab &other)
const
{
33
return
type == other.type
34
&& qFuzzyCompare(position, other.position)
35
&& delimiter == other.delimiter;
36
}
37
38
inline
bool
operator!=(
const
Tab &other)
const
{
39
return
!operator==(other);
40
}
41
42
qreal position;
43
TabType type;
44
QChar delimiter;
45
};
46
47
QTextOption();
48
Q_IMPLICIT QTextOption(Qt::Alignment alignment);
49
~QTextOption();
50
51
QTextOption(
const
QTextOption &o);
52
QTextOption &operator=(
const
QTextOption &o);
53
54
inline
void
setAlignment(Qt::Alignment alignment);
55
inline
Qt::Alignment alignment()
const
{
return
Qt::Alignment(align); }
56
57
inline
void
setTextDirection(Qt::LayoutDirection aDirection) {
this
->direction = aDirection; }
58
inline
Qt::LayoutDirection textDirection()
const
{
return
Qt::LayoutDirection(direction); }
59
60
enum
WrapMode {
61
NoWrap,
62
WordWrap,
63
ManualWrap,
64
WrapAnywhere,
65
WrapAtWordBoundaryOrAnywhere,
66
};
67
inline
void
setWrapMode(WrapMode wrap) { wordWrap = wrap; }
68
inline
WrapMode wrapMode()
const
{
return
static_cast
<WrapMode>(wordWrap); }
69
70
enum
Flag {
71
ShowTabsAndSpaces = 0x1,
72
ShowLineAndParagraphSeparators = 0x2,
73
AddSpaceForLineAndParagraphSeparators = 0x4,
74
SuppressColors = 0x8,
75
ShowDocumentTerminator = 0x10,
76
ShowDefaultIgnorables = 0x20,
77
DisableEmojiParsing = 0x40,
78
IncludeTrailingSpaces = 0x80000000,
79
};
80
Q_DECLARE_FLAGS(Flags, Flag)
81
inline
void
setFlags(Flags flags);
82
inline
Flags flags()
const
{
return
Flags(f); }
83
84
inline
void
setTabStopDistance(qreal tabStopDistance);
85
inline
qreal tabStopDistance()
const
{
return
tab; }
86
87
void
setTabArray(
const
QList<qreal> &tabStops);
88
QList<qreal> tabArray()
const
;
89
90
void
setTabs(
const
QList<Tab> &tabStops);
91
QList<Tab> tabs()
const
;
92
93
void
setUseDesignMetrics(
bool
b) { design = b; }
94
bool
useDesignMetrics()
const
{
return
design; }
95
96
private
:
97
uint align : 9;
98
uint wordWrap : 4;
99
uint design : 1;
100
uint direction : 2;
101
uint unused : 16;
102
uint f;
103
qreal tab;
104
QTextOptionPrivate *d;
105
};
106
107
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextOption::Flags)
108
109
inline
void
QTextOption::setAlignment(Qt::Alignment aalignment)
110
{ align = uint(aalignment.toInt()); }
111
112
inline
void
QTextOption::setFlags(Flags aflags)
113
{ f = uint(aflags.toInt()); }
114
115
inline
void
QTextOption::setTabStopDistance(qreal atabStop)
116
{ tab = atabStop; }
117
118
QT_END_NAMESPACE
119
120
QT_DECL_METATYPE_EXTERN_TAGGED(QTextOption::Tab, QTextOption_Tab, Q_GUI_EXPORT)
121
122
#
endif
// QTEXTOPTION_H
QTextOption
\reentrant
Definition
qtextoption.h:18
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
gui
text
qtextoption.h
Generated on
for Qt by
1.18.0