wio
This commit is contained in:
parent
6f814edaec
commit
c4ba1d320f
@ -12,6 +12,35 @@
|
||||
|
||||
#include <QskRgbValue.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class ButtonBox : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
ButtonBox( QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, parent )
|
||||
{
|
||||
setDefaultAlignment( Qt::AlignHCenter | Qt::AlignTop );
|
||||
setMargins( 30 );
|
||||
|
||||
populate();
|
||||
}
|
||||
|
||||
private:
|
||||
void populate()
|
||||
{
|
||||
(void) new QskSwitchButton( Qt::Vertical, this );
|
||||
(void) new QskSwitchButton( Qt::Horizontal, this );
|
||||
|
||||
auto button3 = new QskSwitchButton( Qt::Vertical, this );
|
||||
button3->setInverted( true );
|
||||
|
||||
auto button4 = new QskSwitchButton( Qt::Horizontal, this );
|
||||
button4->setInverted( true );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ButtonPage::ButtonPage( QQuickItem* parent )
|
||||
: Page( Qt::Horizontal, parent )
|
||||
{
|
||||
@ -30,18 +59,7 @@ void ButtonPage::populate()
|
||||
|
||||
auto button0 = new QskSwitchButton( hbox1 );
|
||||
|
||||
auto hbox2 = new QskLinearBox( Qt::Horizontal );
|
||||
hbox2->setDefaultAlignment( Qt::AlignHCenter | Qt::AlignTop );
|
||||
hbox2->setMargins( 30 );
|
||||
|
||||
(void) new QskSwitchButton( Qt::Vertical, hbox2 );
|
||||
(void) new QskSwitchButton( Qt::Horizontal, hbox2 );
|
||||
|
||||
auto button3 = new QskSwitchButton( Qt::Vertical, hbox2 );
|
||||
button3->setInverted( true );
|
||||
|
||||
auto button4 = new QskSwitchButton( Qt::Horizontal, hbox2 );
|
||||
button4->setInverted( true );
|
||||
auto hbox2 = new ButtonBox();
|
||||
|
||||
auto vbox = new QskLinearBox( Qt::Vertical, this );
|
||||
vbox->addItem( hbox1 );
|
||||
|
@ -25,10 +25,10 @@ SOURCES += \
|
||||
progressbar/ProgressBarPage.cpp \
|
||||
|
||||
HEADERS += \
|
||||
switchbutton/SwitchButtonPage.h
|
||||
button/ButtonPage.h
|
||||
|
||||
SOURCES += \
|
||||
switchbutton/SwitchButtonPage.cpp \
|
||||
button/ButtonPage.cpp \
|
||||
|
||||
HEADERS += \
|
||||
Page.h
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "label/LabelPage.h"
|
||||
#include "progressbar/ProgressBarPage.h"
|
||||
#include "slider/SliderPage.h"
|
||||
#include "switchbutton/SwitchButtonPage.h"
|
||||
#include "button/ButtonPage.h"
|
||||
|
||||
#include <SkinnyFont.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
@ -52,7 +52,7 @@ int main( int argc, char* argv[] )
|
||||
tabView->addTab( "Labels", new LabelPage() );
|
||||
tabView->addTab( "Sliders", new SliderPage() );
|
||||
tabView->addTab( "Progress\nBars", new ProgressBarPage() );
|
||||
tabView->addTab( "Switches", new SwitchButtonPage() );
|
||||
tabView->addTab( "Buttons", new ButtonPage() );
|
||||
|
||||
QSize size( 800, 600 );
|
||||
size = size.expandedTo( tabView->sizeHint().toSize() );
|
||||
|
@ -1,54 +0,0 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SwitchButtonPage.h"
|
||||
|
||||
#include <QskSwitchButton.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskSeparator.h>
|
||||
|
||||
#include <QskRgbValue.h>
|
||||
|
||||
SwitchButtonPage::SwitchButtonPage( QQuickItem* parent )
|
||||
: Page( Qt::Horizontal, parent )
|
||||
{
|
||||
setSpacing( 40 );
|
||||
populate();
|
||||
}
|
||||
|
||||
void SwitchButtonPage::populate()
|
||||
{
|
||||
auto hbox1 = new QskLinearBox();
|
||||
hbox1->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );
|
||||
hbox1->setExtraSpacingAt( Qt::LeftEdge );
|
||||
|
||||
auto label = new QskTextLabel( "Disable the switches:", hbox1 );
|
||||
label->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
|
||||
auto button0 = new QskSwitchButton( hbox1 );
|
||||
|
||||
auto hbox2 = new QskLinearBox( Qt::Horizontal );
|
||||
hbox2->setDefaultAlignment( Qt::AlignHCenter | Qt::AlignTop );
|
||||
hbox2->setMargins( 30 );
|
||||
|
||||
(void) new QskSwitchButton( Qt::Vertical, hbox2 );
|
||||
(void) new QskSwitchButton( Qt::Horizontal, hbox2 );
|
||||
|
||||
auto button3 = new QskSwitchButton( Qt::Vertical, hbox2 );
|
||||
button3->setInverted( true );
|
||||
|
||||
auto button4 = new QskSwitchButton( Qt::Horizontal, hbox2 );
|
||||
button4->setInverted( true );
|
||||
|
||||
auto vbox = new QskLinearBox( Qt::Vertical, this );
|
||||
vbox->addItem( hbox1 );
|
||||
vbox->addItem( new QskSeparator() );
|
||||
vbox->addItem( hbox2 );
|
||||
vbox->setExtraSpacingAt( Qt::BottomEdge );
|
||||
|
||||
QObject::connect( button0, &QskSwitchButton::checkedChanged,
|
||||
hbox2, &QskQuickItem::setDisabled );
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Page.h"
|
||||
|
||||
class SwitchButtonPage : public Page
|
||||
{
|
||||
public:
|
||||
SwitchButtonPage( QQuickItem* = nullptr );
|
||||
|
||||
private:
|
||||
void populate();
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user