2021-08-02 13:27:30 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* 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>
|
2021-08-02 19:17:04 +02:00
|
|
|
#include <QskSeparator.h>
|
2021-08-02 13:27:30 +02:00
|
|
|
|
|
|
|
#include <QskRgbValue.h>
|
|
|
|
|
|
|
|
SwitchButtonPage::SwitchButtonPage( QQuickItem* parent )
|
|
|
|
: Page( Qt::Horizontal, parent )
|
|
|
|
{
|
|
|
|
setGradient( QskRgb::AliceBlue );
|
|
|
|
setSpacing( 40 );
|
|
|
|
|
|
|
|
populate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwitchButtonPage::populate()
|
|
|
|
{
|
2021-08-02 19:17:04 +02:00
|
|
|
auto hbox1 = new QskLinearBox();
|
|
|
|
hbox1->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );
|
|
|
|
hbox1->setExtraSpacingAt( Qt::LeftEdge );
|
2021-08-02 13:27:30 +02:00
|
|
|
|
2021-08-04 08:24:36 +02:00
|
|
|
auto label = new QskTextLabel( "Disable the switches:", hbox1 );
|
2021-08-02 19:17:04 +02:00
|
|
|
label->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
2021-08-04 09:31:16 +02:00
|
|
|
|
2021-08-02 19:17:04 +02:00
|
|
|
auto button0 = new QskSwitchButton( hbox1 );
|
2021-08-02 13:27:30 +02:00
|
|
|
|
2021-08-02 19:17:04 +02:00
|
|
|
auto hbox2 = new QskLinearBox( Qt::Horizontal );
|
|
|
|
hbox2->setDefaultAlignment( Qt::AlignHCenter | Qt::AlignTop );
|
|
|
|
hbox2->setMargins( 30 );
|
2021-08-02 13:27:30 +02:00
|
|
|
|
2021-08-02 19:17:04 +02:00
|
|
|
(void) new QskSwitchButton( Qt::Vertical, hbox2 );
|
|
|
|
(void) new QskSwitchButton( Qt::Horizontal, hbox2 );
|
2021-08-02 13:27:30 +02:00
|
|
|
|
2021-08-02 19:17:04 +02:00
|
|
|
auto button3 = new QskSwitchButton( Qt::Vertical, hbox2 );
|
|
|
|
button3->setInverted( true );
|
2021-08-02 13:27:30 +02:00
|
|
|
|
2021-08-02 19:17:04 +02:00
|
|
|
auto button4 = new QskSwitchButton( Qt::Horizontal, hbox2 );
|
|
|
|
button4->setInverted( true );
|
2021-08-02 13:27:30 +02:00
|
|
|
|
2021-08-02 19:17:04 +02:00
|
|
|
auto vbox = new QskLinearBox( Qt::Vertical, this );
|
|
|
|
vbox->addItem( hbox1 );
|
|
|
|
vbox->addItem( new QskSeparator() );
|
|
|
|
vbox->addItem( hbox2 );
|
2021-08-02 13:27:30 +02:00
|
|
|
vbox->setExtraSpacingAt( Qt::BottomEdge );
|
2021-08-02 19:17:04 +02:00
|
|
|
|
|
|
|
QObject::connect( button0, &QskSwitchButton::checkedChanged,
|
|
|
|
hbox2, &QskQuickItem::setDisabled );
|
2021-08-02 13:27:30 +02:00
|
|
|
}
|