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
qquicktabbutton.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
8
9#include <QtGui/qpa/qplatformtheme.h>
10
12
13/*!
14 \qmltype TabButton
15 \inherits AbstractButton
16//! \nativetype QQuickTabButton
17 \inqmlmodule QtQuick.Controls
18 \since 5.7
19 \ingroup qtquickcontrols-navigation
20 \brief Button with a look suitable for a TabBar.
21
22 \image qtquickcontrols-tabbutton.png
23
24 TabButton is used in conjunction with a \l TabBar.
25
26 \snippet qtquickcontrols-tabbutton.qml 1
27
28 TabButton inherits its API from AbstractButton. For instance, you can set
29 \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
30 using the AbstractButton API.
31
32 \sa TabBar, {Customizing TabButton}, {Button Controls}, {Navigation Controls}
33*/
34
35class Q_QUICKTEMPLATES2_EXPORT QQuickTabButtonPrivate : public QQuickAbstractButtonPrivate
36{
37 Q_DECLARE_PUBLIC(QQuickTabButton)
38
39public:
40 QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::TabBar); }
41};
42
43QQuickTabButton::QQuickTabButton(QQuickItem *parent)
44 : QQuickAbstractButton(*(new QQuickTabButtonPrivate), parent)
45{
46 setCheckable(true);
47 setAutoExclusive(true);
48}
49
50QFont QQuickTabButton::defaultFont() const
51{
52 return QQuickTheme::font(QQuickTheme::TabBar);
53}
54
55#if QT_CONFIG(accessibility)
56QAccessible::Role QQuickTabButton::accessibleRole() const
57{
58 return QAccessible::PageTab;
59}
60#endif
61
62QT_END_NAMESPACE
63
64#include "moc_qquicktabbutton_p.cpp"
Button with a look suitable for a TabBar.