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
4#ifndef QQUICKTABBAR_P_H
5#define QQUICKTABBAR_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 <QtQuickTemplates2/private/qquickcontainer_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class QQuickTabBarPrivate;
23class QQuickTabBarAttached;
24class QQuickTabBarAttachedPrivate;
25
26class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBar : public QQuickContainer
27{
28 Q_OBJECT
29 Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
30 QML_NAMED_ELEMENT(TabBar)
31 QML_ATTACHED(QQuickTabBarAttached)
32 QML_ADDED_IN_VERSION(2, 0)
33
34public:
35 explicit QQuickTabBar(QQuickItem *parent = nullptr);
36
37 enum Position {
38 Header,
39 Footer
40 };
41 Q_ENUM(Position)
42
43 Position position() const;
44 void setPosition(Position position);
45
46 static QQuickTabBarAttached *qmlAttachedProperties(QObject *object);
47
48Q_SIGNALS:
49 void positionChanged();
50
51protected:
52 void updatePolish() override;
53 void componentComplete() override;
54 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
55 bool isContent(QQuickItem *item) const override;
56 void itemAdded(int index, QQuickItem *item) override;
57 void itemMoved(int index, QQuickItem *item) override;
58 void itemRemoved(int index, QQuickItem *item) override;
59#if QT_CONFIG(wheelevent)
60 void wheelEvent(QWheelEvent *event) override;
61#endif
62
63 QFont defaultFont() const override;
64
65#if QT_CONFIG(accessibility)
66 QAccessible::Role accessibleRole() const override;
67#endif
68
69private:
70 Q_DISABLE_COPY(QQuickTabBar)
71 Q_DECLARE_PRIVATE(QQuickTabBar)
72};
73
74class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBarAttached : public QObject
75{
76 Q_OBJECT
77 Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
78 Q_PROPERTY(QQuickTabBar *tabBar READ tabBar NOTIFY tabBarChanged FINAL)
79 Q_PROPERTY(QQuickTabBar::Position position READ position NOTIFY positionChanged FINAL)
80
81public:
82 explicit QQuickTabBarAttached(QObject *parent = nullptr);
83
84 int index() const;
85 QQuickTabBar *tabBar() const;
86 QQuickTabBar::Position position() const;
87
88Q_SIGNALS:
89 void indexChanged();
90 void tabBarChanged();
91 void positionChanged();
92
93private:
94 Q_DISABLE_COPY(QQuickTabBarAttached)
95 Q_DECLARE_PRIVATE(QQuickTabBarAttached)
96};
97
98QT_END_NAMESPACE
99
100QML_DECLARE_TYPE(QQuickTabBar)
101
102#endif // QQUICKTABBAR_P_H
103

source code of qtdeclarative/src/quicktemplates/qquicktabbar_p.h