QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskTabView.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_TAB_VIEW_H
7#define QSK_TAB_VIEW_H
8
9#include "QskControl.h"
10#include "QskNamespace.h"
11
12class QskTabBar;
13class QskTabButton;
14
15class QSK_EXPORT QskTabView : public QskControl
16{
17 Q_OBJECT
18
19 Q_PROPERTY( QskTabBar* tabBar READ tabBar )
20
21 Q_PROPERTY( Qt::Edge tabBarEdge READ tabBarEdge
22 WRITE setTabBarEdge NOTIFY tabBarEdgeChanged FINAL )
23
24 Q_PROPERTY( bool autoFitTabs READ autoFitTabs
25 WRITE setAutoFitTabs NOTIFY autoFitTabsChanged FINAL )
26
27 Q_PROPERTY( Qt::Orientation orientation READ orientation )
28
29 Q_PROPERTY( int count READ count NOTIFY countChanged FINAL )
30
31 Q_PROPERTY( int currentIndex READ currentIndex
32 WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL )
33
34 typedef QskControl Inherited;
35
36 public:
37 QSK_SUBCONTROLS( TabBar, Page )
38
39 QskTabView( QQuickItem* parent = nullptr );
40 ~QskTabView() override;
41
42 const QskTabBar* tabBar() const;
43 QskTabBar* tabBar();
44
45 void setTabBarEdge( Qt::Edge );
46 Qt::Edge tabBarEdge() const;
47
48 void setAutoFitTabs( bool );
49 bool autoFitTabs() const;
50
51 Qt::Orientation orientation() const;
52
53 Q_INVOKABLE int addTab( const QString&, QQuickItem* );
54 Q_INVOKABLE int insertTab( int index, const QString&, QQuickItem* );
55
56 Q_INVOKABLE void removeTab( int index );
57 Q_INVOKABLE void clear( bool autoDelete = false );
58
59 QQuickItem* pageAt( int index ) const;
60 int pageIndex( const QQuickItem* );
61
62 QQuickItem* currentPage() const;
63
64 int currentIndex() const;
65 int count() const;
66
67 QRectF tabRect() const;
68
70
71 void setTabEnabled( int , bool );
72 bool isTabEnabled( int index ) const;
73
74#if 1
75 // see: https://github.com/uwerat/qskinny/issues/283
76
77 int addTab( QskTabButton*, QQuickItem* );
78 int insertTab( int index, QskTabButton*, QQuickItem* );
79
80 QskTabButton* buttonAt( int index ) const;
81 int buttonIndex( const QskTabButton* );
82 QskTabButton* currentButton() const;
83#endif
84
85 public Q_SLOTS:
86 void setCurrentIndex( int index );
87
88 Q_SIGNALS:
89 void currentIndexChanged( int index );
90 void countChanged( int );
91 void tabBarEdgeChanged( Qt::Edge );
92 void autoFitTabsChanged( bool );
93
94 protected:
95 bool event( QEvent* event ) override;
96 void updateLayout() override;
97
98 QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
99
100 private:
101 class PrivateData;
102 std::unique_ptr< PrivateData > m_data;
103};
104
105#endif
Variation
Some sort of variation.
Definition QskAspect.h:82
Base class of all controls.
Definition QskControl.h:23
virtual QskAspect::Variation effectiveVariation() const