diff --git a/examples/gallery/button/ButtonPage.cpp b/examples/gallery/button/ButtonPage.cpp index b62865ce..ca88acd4 100644 --- a/examples/gallery/button/ButtonPage.cpp +++ b/examples/gallery/button/ButtonPage.cpp @@ -17,13 +17,27 @@ namespace class ButtonBox : public QskLinearBox { public: - ButtonBox( QQuickItem* parent = nullptr ) - : QskLinearBox( Qt::Horizontal, 3, parent ) + ButtonBox( Qt::Orientation orientation, QQuickItem* parent = nullptr ) + : ButtonBox( orientation, -1, parent ) { - setSpacing( 20 ); - setExtraSpacingAt( Qt::BottomEdge ); - setDefaultAlignment( Qt::AlignCenter ); + } + ButtonBox( Qt::Orientation orientation, + uint dimension, QQuickItem* parent = nullptr ) + : QskLinearBox( orientation, dimension, parent ) + { + setSpacing( 10 ); + setExtraSpacingAt( Qt::LeftEdge | Qt::RightEdge | Qt::BottomEdge ); + } + }; + + class PushButtonBox : public ButtonBox + { + public: + PushButtonBox( QQuickItem* parent = nullptr ) + : ButtonBox( Qt::Horizontal, 3, parent ) + { + setDefaultAlignment( Qt::AlignCenter ); populate(); } @@ -112,43 +126,29 @@ namespace } }; - class SwitchButtonBox : public QskLinearBox + class SwitchButtonBox : public ButtonBox { public: SwitchButtonBox( QQuickItem* parent = nullptr ) - : QskLinearBox( Qt::Horizontal, parent ) + : ButtonBox( Qt::Horizontal, parent ) { - setSpacing( 20 ); - setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed ); - - setExtraSpacingAt( Qt::LeftEdge | Qt::RightEdge | Qt::BottomEdge ); - for ( auto orientation : { Qt::Vertical, Qt::Horizontal } ) { (void) new QskSwitchButton( orientation, this ); auto button = new QskSwitchButton( orientation, this ); - button->setChecked( true ); - - button = new QskSwitchButton( orientation, this ); - button->setInverted( true ); - - button = new QskSwitchButton( orientation, this ); button->setInverted( true ); button->setChecked( true ); } } }; - class CheckButtonBox : public QskLinearBox + class CheckButtonBox : public ButtonBox { public: CheckButtonBox( QQuickItem* parent = nullptr ) - : QskLinearBox( Qt::Horizontal, 2, parent ) + : ButtonBox( Qt::Horizontal, 2, parent ) { - setSpacing( 20 ); - setExtraSpacingAt( Qt::LeftEdge | Qt::RightEdge | Qt::BottomEdge ); - auto button1 = new QskCheckBox( "Options 1", this ); button1->setChecked( true ); @@ -160,15 +160,12 @@ namespace } }; - class RadioButtonBox : public QskLinearBox + class RadioButtonBox : public ButtonBox { public: RadioButtonBox( QQuickItem* parent = nullptr ) - : QskLinearBox( Qt::Horizontal, parent ) + : ButtonBox( Qt::Horizontal, parent ) { - setSpacing( 20 ); - setExtraSpacingAt( Qt::LeftEdge | Qt::RightEdge | Qt::BottomEdge ); - new QskRadioBox( { "One", "Two", "Three" }, this ); auto radioBox = new QskRadioBox( { "One", "Two", "Three" }, this ); @@ -180,18 +177,16 @@ namespace ButtonPage::ButtonPage( QQuickItem* parent ) : Page( Qt::Vertical, parent ) { - setSpacing( 40 ); - populate(); -} + setSpacing( 20 ); -void ButtonPage::populate() -{ - new ButtonBox( this ); - new QskSeparator( Qt::Horizontal, this ); - new SwitchButtonBox( this ); + new PushButtonBox( this ); new QskSeparator( Qt::Horizontal, this ); auto hBox = new QskLinearBox( Qt::Horizontal, this ); + + new SwitchButtonBox( hBox ); + new QskSeparator( Qt::Vertical, hBox ); new CheckButtonBox( hBox ); + new QskSeparator( Qt::Vertical, hBox ); new RadioButtonBox( hBox ); } diff --git a/examples/gallery/button/ButtonPage.h b/examples/gallery/button/ButtonPage.h index ad7cad86..f1a9a671 100644 --- a/examples/gallery/button/ButtonPage.h +++ b/examples/gallery/button/ButtonPage.h @@ -11,7 +11,4 @@ class ButtonPage : public Page { public: ButtonPage( QQuickItem* = nullptr ); - - private: - void populate(); }; diff --git a/examples/gallery/main.cpp b/examples/gallery/main.cpp index 14ebfe7a..6e35fdbe 100644 --- a/examples/gallery/main.cpp +++ b/examples/gallery/main.cpp @@ -178,6 +178,8 @@ namespace Header( QQuickItem* parent = nullptr ) : QskLinearBox( Qt::Horizontal, parent ) { + setPaddingHint( QskBox::Panel, 5 ); + initSizePolicy( QskSizePolicy::Ignored, QskSizePolicy::Fixed ); setPanel( true );