diff --git a/examples/gallery/main.cpp b/examples/gallery/main.cpp index 17a91c07..9edaf1b6 100644 --- a/examples/gallery/main.cpp +++ b/examples/gallery/main.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -204,7 +205,7 @@ namespace Q_OBJECT public: - Header( QQuickItem* parent = nullptr ) + Header( int tabCount, QQuickItem* parent = nullptr ) : QskLinearBox( Qt::Horizontal, parent ) { setPaddingHint( QskBox::Panel, 5 ); @@ -215,6 +216,9 @@ namespace new FileButton( "File", this ); new SkinButton( "Skin", this ); + addStretch( 10 ); + m_pageIndicator = new QskPageIndicator( tabCount, this ); + m_pageIndicator->setCurrentIndex( 0 ); addStretch( 10 ); { @@ -236,9 +240,18 @@ namespace } } + public Q_SLOTS: + void setCurrentTab( int index ) + { + m_pageIndicator->setCurrentIndex( index ); + } + Q_SIGNALS: void enabledToggled( bool ); void drawerRequested(); + + private: + QskPageIndicator* m_pageIndicator; }; class MainView : public QskMainView @@ -247,20 +260,23 @@ namespace MainView( QQuickItem* parent = nullptr ) : QskMainView( parent ) { - auto header = new Header( this ); - auto tabView = new TabView( this ); tabView->addPage( "Buttons", new ButtonPage() ); tabView->addPage( "Labels", new LabelPage() ); tabView->addPage( "Inputs", new InputPage() ); - tabView->addPage( "Progress\nBars", new ProgressBarPage() ); + tabView->addPage( "Indicators", new ProgressBarPage() ); tabView->addPage( "Selectors", new SelectorPage() ); tabView->addPage( "Dialogs", new DialogPage() ); tabView->addPage( "ListBox", new ListBoxPage() ); + auto header = new Header( tabView->count(), this ); + connect( header, &Header::enabledToggled, tabView, &TabView::setPagesEnabled ); + connect( tabView, &TabView::currentIndexChanged, + header, &Header::setCurrentTab ); + auto drawer = new Drawer( tabView ); drawer->setEdge( Qt::RightEdge );