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 {Tab button in tab bar}
24
25 TabButton is used in conjunction with a \l TabBar.
26
27 \snippet qtquickcontrols-tabbutton.qml 1
28
29 TabButton inherits its API from AbstractButton. For instance, you can set
30 \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
31 using the AbstractButton API.
32
33 \sa TabBar, {Customizing TabButton}, {Button Controls}, {Navigation Controls}
34*/
35
36class Q_QUICKTEMPLATES2_EXPORT QQuickTabButtonPrivate : public QQuickAbstractButtonPrivate
37{
38 Q_DECLARE_PUBLIC(QQuickTabButton)
39
40public:
41 QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::TabBar); }
42};
43
44QQuickTabButton::QQuickTabButton(QQuickItem *parent)
45 : QQuickAbstractButton(*(new QQuickTabButtonPrivate), parent)
46{
47 setCheckable(true);
48 setAutoExclusive(true);
49}
50
51QFont QQuickTabButton::defaultFont() const
52{
53 return QQuickTheme::font(QQuickTheme::TabBar);
54}
55
56#if QT_CONFIG(accessibility)
57QAccessible::Role QQuickTabButton::accessibleRole() const
58{
59 return QAccessible::PageTab;
60}
61#endif
62
63QT_END_NAMESPACE
64
65#include "moc_qquicktabbutton_p.cpp"
Button with a look suitable for a TabBar.
Combined button and popup list for selecting options.