1/****************************************************************************
2**
3** Copyright (C) 2017 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL3$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or later as published by the Free
28** Software Foundation and appearing in the file LICENSE.GPL included in
29** the packaging of this file. Please review the following information to
30** ensure the GNU General Public License version 2.0 requirements will be
31** met: http://www.gnu.org/licenses/gpl-2.0.html.
32**
33** $QT_END_LICENSE$
34**
35****************************************************************************/
36
37#ifndef QQUICKTABBAR_P_H
38#define QQUICKTABBAR_P_H
39
40//
41// W A R N I N G
42// -------------
43//
44// This file is not part of the Qt API. It exists purely as an
45// implementation detail. This header file may change from version to
46// version without notice, or even be removed.
47//
48// We mean it.
49//
50
51#include <QtQuickTemplates2/private/qquickcontainer_p.h>
52
53QT_BEGIN_NAMESPACE
54
55class QQuickTabBarPrivate;
56class QQuickTabBarAttached;
57class QQuickTabBarAttachedPrivate;
58
59class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBar : public QQuickContainer
60{
61 Q_OBJECT
62 Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
63 // 2.2 (Qt 5.9)
64 Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 2) // re-declare QQuickContainer::contentWidth (REV 5)
65 Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 2) // re-declare QQuickContainer::contentHeight (REV 5)
66
67public:
68 explicit QQuickTabBar(QQuickItem *parent = nullptr);
69
70 enum Position {
71 Header,
72 Footer
73 };
74 Q_ENUM(Position)
75
76 Position position() const;
77 void setPosition(Position position);
78
79 static QQuickTabBarAttached *qmlAttachedProperties(QObject *object);
80
81Q_SIGNALS:
82 void positionChanged();
83
84protected:
85 void updatePolish() override;
86 void componentComplete() override;
87 void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
88 bool isContent(QQuickItem *item) const override;
89 void itemAdded(int index, QQuickItem *item) override;
90 void itemMoved(int index, QQuickItem *item) override;
91 void itemRemoved(int index, QQuickItem *item) override;
92
93 QFont defaultFont() const override;
94 QPalette defaultPalette() const override;
95
96#if QT_CONFIG(accessibility)
97 QAccessible::Role accessibleRole() const override;
98#endif
99
100private:
101 Q_DISABLE_COPY(QQuickTabBar)
102 Q_DECLARE_PRIVATE(QQuickTabBar)
103};
104
105class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBarAttached : public QObject
106{
107 Q_OBJECT
108 Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
109 Q_PROPERTY(QQuickTabBar *tabBar READ tabBar NOTIFY tabBarChanged FINAL)
110 Q_PROPERTY(QQuickTabBar::Position position READ position NOTIFY positionChanged FINAL)
111
112public:
113 explicit QQuickTabBarAttached(QObject *parent = nullptr);
114
115 int index() const;
116 QQuickTabBar *tabBar() const;
117 QQuickTabBar::Position position() const;
118
119Q_SIGNALS:
120 void indexChanged();
121 void tabBarChanged();
122 void positionChanged();
123
124private:
125 Q_DISABLE_COPY(QQuickTabBarAttached)
126 Q_DECLARE_PRIVATE(QQuickTabBarAttached)
127};
128
129QT_END_NAMESPACE
130
131QML_DECLARE_TYPE(QQuickTabBar)
132QML_DECLARE_TYPEINFO(QQuickTabBar, QML_HAS_ATTACHED_PROPERTIES)
133
134#endif // QQUICKTABBAR_P_H
135

source code of qtquickcontrols2/src/quicktemplates2/qquicktabbar_p.h