page indicator added
This commit is contained in:
parent
0bdc7f5f86
commit
99080bf265
@ -24,6 +24,7 @@
|
|||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
#include <QskSwitchButton.h>
|
#include <QskSwitchButton.h>
|
||||||
#include <QskPushButton.h>
|
#include <QskPushButton.h>
|
||||||
|
#include <QskPageIndicator.h>
|
||||||
#include <QskScrollArea.h>
|
#include <QskScrollArea.h>
|
||||||
#include <QskMenu.h>
|
#include <QskMenu.h>
|
||||||
#include <QskWindow.h>
|
#include <QskWindow.h>
|
||||||
@ -204,7 +205,7 @@ namespace
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Header( QQuickItem* parent = nullptr )
|
Header( int tabCount, QQuickItem* parent = nullptr )
|
||||||
: QskLinearBox( Qt::Horizontal, parent )
|
: QskLinearBox( Qt::Horizontal, parent )
|
||||||
{
|
{
|
||||||
setPaddingHint( QskBox::Panel, 5 );
|
setPaddingHint( QskBox::Panel, 5 );
|
||||||
@ -215,6 +216,9 @@ namespace
|
|||||||
new FileButton( "File", this );
|
new FileButton( "File", this );
|
||||||
new SkinButton( "Skin", this );
|
new SkinButton( "Skin", this );
|
||||||
|
|
||||||
|
addStretch( 10 );
|
||||||
|
m_pageIndicator = new QskPageIndicator( tabCount, this );
|
||||||
|
m_pageIndicator->setCurrentIndex( 0 );
|
||||||
addStretch( 10 );
|
addStretch( 10 );
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -236,9 +240,18 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setCurrentTab( int index )
|
||||||
|
{
|
||||||
|
m_pageIndicator->setCurrentIndex( index );
|
||||||
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void enabledToggled( bool );
|
void enabledToggled( bool );
|
||||||
void drawerRequested();
|
void drawerRequested();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QskPageIndicator* m_pageIndicator;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MainView : public QskMainView
|
class MainView : public QskMainView
|
||||||
@ -247,20 +260,23 @@ namespace
|
|||||||
MainView( QQuickItem* parent = nullptr )
|
MainView( QQuickItem* parent = nullptr )
|
||||||
: QskMainView( parent )
|
: QskMainView( parent )
|
||||||
{
|
{
|
||||||
auto header = new Header( this );
|
|
||||||
|
|
||||||
auto tabView = new TabView( this );
|
auto tabView = new TabView( this );
|
||||||
tabView->addPage( "Buttons", new ButtonPage() );
|
tabView->addPage( "Buttons", new ButtonPage() );
|
||||||
tabView->addPage( "Labels", new LabelPage() );
|
tabView->addPage( "Labels", new LabelPage() );
|
||||||
tabView->addPage( "Inputs", new InputPage() );
|
tabView->addPage( "Inputs", new InputPage() );
|
||||||
tabView->addPage( "Progress\nBars", new ProgressBarPage() );
|
tabView->addPage( "Indicators", new ProgressBarPage() );
|
||||||
tabView->addPage( "Selectors", new SelectorPage() );
|
tabView->addPage( "Selectors", new SelectorPage() );
|
||||||
tabView->addPage( "Dialogs", new DialogPage() );
|
tabView->addPage( "Dialogs", new DialogPage() );
|
||||||
tabView->addPage( "ListBox", new ListBoxPage() );
|
tabView->addPage( "ListBox", new ListBoxPage() );
|
||||||
|
|
||||||
|
auto header = new Header( tabView->count(), this );
|
||||||
|
|
||||||
connect( header, &Header::enabledToggled,
|
connect( header, &Header::enabledToggled,
|
||||||
tabView, &TabView::setPagesEnabled );
|
tabView, &TabView::setPagesEnabled );
|
||||||
|
|
||||||
|
connect( tabView, &TabView::currentIndexChanged,
|
||||||
|
header, &Header::setCurrentTab );
|
||||||
|
|
||||||
auto drawer = new Drawer( tabView );
|
auto drawer = new Drawer( tabView );
|
||||||
drawer->setEdge( Qt::RightEdge );
|
drawer->setEdge( Qt::RightEdge );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user