qskinny/src/controls/QskTabView.h

89 lines
2.2 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_TAB_VIEW_H
#define QSK_TAB_VIEW_H
#include "QskControl.h"
#include "QskNamespace.h"
2017-07-21 18:21:34 +02:00
class QskTabBar;
class QskTabButton;
class QSK_EXPORT QskTabView : public QskControl
{
Q_OBJECT
Q_PROPERTY( Qsk::Position tabPosition READ tabPosition
WRITE setTabPosition NOTIFY tabPositionChanged FINAL )
Q_PROPERTY( Qt::Orientation orientation READ orientation )
2017-07-21 18:21:34 +02:00
Q_PROPERTY( int count READ count NOTIFY countChanged FINAL )
2018-08-03 08:15:28 +02:00
2017-07-21 18:21:34 +02:00
Q_PROPERTY( int currentIndex READ currentIndex
WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL )
typedef QskControl Inherited;
2018-08-03 08:15:28 +02:00
public:
2017-07-21 18:21:34 +02:00
QSK_SUBCONTROLS( TabBar, Page )
QskTabView( QQuickItem* parent = nullptr );
QskTabView( Qsk::Position tabPosition, QQuickItem* parent = nullptr );
2017-07-21 18:21:34 +02:00
2018-07-31 17:32:25 +02:00
~QskTabView() override;
2017-07-21 18:21:34 +02:00
const QskTabBar* tabBar() const;
void setTabPosition( Qsk::Position );
Qsk::Position tabPosition() const;
2017-07-21 18:21:34 +02:00
Qt::Orientation orientation() const;
int addTab( QskTabButton*, QQuickItem* );
int insertTab( int index, QskTabButton*, QQuickItem* );
int addTab( const QString&, QQuickItem* );
int insertTab( int index, const QString&, QQuickItem* );
void removeTab( int index );
void clear();
QQuickItem* itemAt( int index ) const;
QskTabButton* buttonAt( int index ) const;
2019-03-15 15:38:52 +01:00
int itemIndex( const QQuickItem* );
int buttonIndex( const QskTabButton* );
2017-07-21 18:21:34 +02:00
QQuickItem* currentItem() const;
QskTabButton* currentButton() const;
int currentIndex() const;
int count() const;
QRectF tabRect() const;
2018-07-31 17:32:25 +02:00
QSizeF contentsSizeHint() const override;
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
public Q_SLOTS:
2017-07-21 18:21:34 +02:00
void setCurrentIndex( int index );
2018-08-03 08:15:28 +02:00
Q_SIGNALS:
2017-07-21 18:21:34 +02:00
void currentIndexChanged( int index );
void countChanged( int );
void tabPositionChanged( Qsk::Position );
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
protected:
2018-07-31 17:32:25 +02:00
bool event( QEvent* event ) override;
void updateLayout() override;
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
private:
2017-07-21 18:21:34 +02:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif