2020-08-11 17:56:53 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the 3-clause BSD License
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "label/LabelPage.h"
|
|
|
|
#include "progressbar/ProgressBarPage.h"
|
|
|
|
#include "slider/SliderPage.h"
|
2021-08-02 13:27:30 +02:00
|
|
|
#include "switchbutton/SwitchButtonPage.h"
|
2020-08-11 17:56:53 +02:00
|
|
|
|
|
|
|
#include <SkinnyFont.h>
|
|
|
|
#include <SkinnyShortcut.h>
|
|
|
|
#include <SkinnyShapeProvider.h>
|
|
|
|
|
|
|
|
#include <QskFocusIndicator.h>
|
|
|
|
#include <QskObjectCounter.h>
|
|
|
|
#include <QskTabView.h>
|
|
|
|
#include <QskWindow.h>
|
|
|
|
|
|
|
|
#include <QGuiApplication>
|
|
|
|
|
2021-12-06 19:20:59 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class TabView : public QskTabView
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TabView( QQuickItem* parent = nullptr )
|
|
|
|
: QskTabView( parent )
|
|
|
|
{
|
|
|
|
setMargins( 10 );
|
|
|
|
setTabPosition( Qsk::Left );
|
|
|
|
setAutoFitTabs( true );
|
|
|
|
|
|
|
|
connect( this, &QskTabView::currentIndexChanged,
|
|
|
|
this, &TabView::updateViewPanel );
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void aboutToShow() override
|
|
|
|
{
|
|
|
|
updateViewPanel();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateViewPanel()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
We should have a better way to set individual colors
|
|
|
|
for each tab page background
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( auto page = dynamic_cast< const ::Page* >( currentItem() ) )
|
|
|
|
setGradientHint( QskTabView::Page, page->gradient() );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-08-11 17:56:53 +02:00
|
|
|
int main( int argc, char* argv[] )
|
|
|
|
{
|
|
|
|
#ifdef ITEM_STATISTICS
|
|
|
|
QskObjectCounter counter( true );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Qsk::addGraphicProvider( "shapes", new SkinnyShapeProvider() );
|
|
|
|
|
|
|
|
QGuiApplication app( argc, argv );
|
|
|
|
|
|
|
|
SkinnyFont::init( &app );
|
|
|
|
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
|
|
|
|
2021-12-06 19:20:59 +01:00
|
|
|
auto tabView = new TabView();
|
2020-08-11 17:56:53 +02:00
|
|
|
|
|
|
|
tabView->addTab( "Labels", new LabelPage() );
|
|
|
|
tabView->addTab( "Sliders", new SliderPage() );
|
|
|
|
tabView->addTab( "Progress\nBars", new ProgressBarPage() );
|
2021-08-02 13:27:30 +02:00
|
|
|
tabView->addTab( "Switches", new SwitchButtonPage() );
|
2020-08-11 17:56:53 +02:00
|
|
|
|
|
|
|
QSize size( 800, 600 );
|
|
|
|
size = size.expandedTo( tabView->sizeHint().toSize() );
|
|
|
|
|
|
|
|
QskWindow window;
|
|
|
|
window.addItem( tabView );
|
|
|
|
window.addItem( new QskFocusIndicator() );
|
|
|
|
|
|
|
|
window.resize( size );
|
|
|
|
window.show();
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|