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
qquicktoolseparator.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 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
#
include
"qquicktoolseparator_p.h"
6
7
#
include
"qquickcontrol_p_p.h"
8
9
QT_BEGIN_NAMESPACE
10
11
/*!
12
\qmltype ToolSeparator
13
\inherits Control
14
//! \nativetype QQuickToolSeparator
15
\inqmlmodule QtQuick.Controls
16
\since 5.8
17
\ingroup qtquickcontrols-separators
18
\brief Separates a group of items in a toolbar from adjacent items.
19
20
ToolSeparator is used to visually distinguish between groups of items in a
21
toolbar by separating them with a line. It can be used in horizontal or
22
vertical toolbars by setting the \l orientation property to \c Qt.Vertical
23
or \c Qt.Horizontal, respectively.
24
25
\image qtquickcontrols-toolseparator.png
26
{Tool separator dividing toolbar buttons}
27
28
\snippet qtquickcontrols-toolseparator.qml 1
29
30
\sa {Customizing ToolSeparator}, {Separator Controls}
31
*/
32
33
class
QQuickToolSeparatorPrivate
:
public
QQuickControlPrivate
34
{
35
Q_DECLARE_PUBLIC(QQuickToolSeparator)
36
37
public
:
38
QPalette
defaultPalette
()
const
override
{
return
QQuickTheme
::
palette
(
QQuickTheme
::
ToolBar
); }
39
40
Qt
::
Orientation
orientation
=
Qt
::
Vertical
;
41
};
42
43
QQuickToolSeparator::QQuickToolSeparator(QQuickItem *parent)
44
: QQuickControl(*(
new
QQuickToolSeparatorPrivate), parent)
45
{
46
}
47
48
/*!
49
\qmlproperty enumeration QtQuick.Controls::ToolSeparator::orientation
50
51
This property holds the orientation of the tool separator.
52
53
Possible values:
54
\value Qt.Horizontal A horizontal separator is used in a vertical toolbar.
55
\value Qt.Vertical A vertical separator is used in a horizontal toolbar. (default)
56
*/
57
Qt::Orientation QQuickToolSeparator::orientation()
const
58
{
59
Q_D(
const
QQuickToolSeparator);
60
return
d->orientation;
61
}
62
63
void
QQuickToolSeparator::setOrientation(Qt::Orientation orientation)
64
{
65
Q_D(QQuickToolSeparator);
66
if
(d->orientation == orientation)
67
return
;
68
69
d->orientation = orientation;
70
emit orientationChanged();
71
}
72
73
/*!
74
\readonly
75
\qmlproperty bool QtQuick.Controls::ToolSeparator::horizontal
76
77
This property holds whether \l orientation is equal to \c Qt.Horizontal.
78
79
It is useful for \l {Customizing ToolSeparator}{customizing ToolSeparator}.
80
81
\sa orientation, vertical
82
*/
83
bool
QQuickToolSeparator::isHorizontal()
const
84
{
85
Q_D(
const
QQuickToolSeparator);
86
return
d->orientation == Qt::Horizontal;
87
}
88
89
/*!
90
\readonly
91
\qmlproperty bool QtQuick.Controls::ToolSeparator::vertical
92
93
This property holds whether \l orientation is equal to \c Qt.Vertical.
94
95
It is useful for \l {Customizing ToolSeparator}{customizing ToolSeparator}.
96
97
\sa orientation, horizontal
98
*/
99
bool
QQuickToolSeparator::isVertical()
const
100
{
101
Q_D(
const
QQuickToolSeparator);
102
return
d->orientation == Qt::Vertical;
103
}
104
105
QFont QQuickToolSeparator::defaultFont()
const
106
{
107
return
QQuickTheme::font(QQuickTheme::ToolBar);
108
}
109
110
#
if
QT_CONFIG
(
accessibility
)
111
QAccessible::Role QQuickToolSeparator::accessibleRole()
const
112
{
113
return
QAccessible::Separator;
114
}
115
#
endif
116
117
QT_END_NAMESPACE
118
119
#
include
"moc_qquicktoolseparator_p.cpp"
QQuickToolSeparatorPrivate
Separates a group of items in a toolbar from adjacent items.
Definition
qquicktoolseparator.cpp:34
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
qtdeclarative
src
quicktemplates
qquicktoolseparator.cpp
Generated on
for Qt by
1.16.1