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

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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