Gallery: Make a bit nicer

This commit is contained in:
Peter Hartmann 2023-02-24 15:06:00 +01:00 committed by uwerat
parent a3e749157f
commit ebc8494359

View File

@ -17,7 +17,7 @@ namespace
{ {
public: public:
ButtonBox( QQuickItem* parent = nullptr ) ButtonBox( QQuickItem* parent = nullptr )
: QskLinearBox( Qt::Horizontal, 4, parent ) : QskLinearBox( Qt::Horizontal, 3, parent )
{ {
setSpacing( 20 ); setSpacing( 20 );
setExtraSpacingAt( Qt::BottomEdge ); setExtraSpacingAt( Qt::BottomEdge );
@ -29,90 +29,85 @@ namespace
private: private:
void populate() void populate()
{ {
const char* texts[] = { "Press Me", "Check Me" }; auto* filledButton1 = new QskPushButton( this );
filledButton1->setGraphicSource( "airport_shuttle" );
filledButton1->setText( "normal" );
for ( int i = 0; i < 6; i++ ) auto* filledButton2 = new QskPushButton( this );
{ filledButton2->setText( "normal" );
const int index = i % 2;
auto button = new QskPushButton( this ); auto* filledButton3 = new QskPushButton( this );
button->setCheckable( index != 0 ); filledButton3->setGraphicSource( "airport_shuttle" );
//button->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
if ( i > 1 )
{
auto src = QStringLiteral( "plus" );
button->setGraphicSource( src );
}
if ( i < 2 || i > 3 ) auto* checkableButton1 = new QskPushButton( this );
{ checkableButton1->setGraphicSource( "airport_shuttle" );
button->setText( texts[ index ] ); checkableButton1->setText( "checkable" );
} checkableButton1->setCheckable( true );
}
auto* checkableButton2 = new QskPushButton( this );
checkableButton2->setText( "checkable" );
checkableButton2->setCheckable( true );
auto* checkableButton3 = new QskPushButton( this );
checkableButton3->setGraphicSource( "airport_shuttle" );
checkableButton3->setCheckable( true );
addSpacer( 0 );
addSpacer( 0 );
auto* outlinedButton1 = new QskPushButton( this ); auto* outlinedButton1 = new QskPushButton( this );
outlinedButton1->setEmphasis( QskPushButton::LowEmphasis ); outlinedButton1->setEmphasis( QskPushButton::LowEmphasis );
outlinedButton1->setGraphicSource( "plus" ); outlinedButton1->setGraphicSource( "flight" );
outlinedButton1->setText( "Outlined" ); outlinedButton1->setText( "low emphasis" );
auto* outlinedButton2 = new QskPushButton( this ); auto* outlinedButton2 = new QskPushButton( this );
outlinedButton2->setEmphasis( QskPushButton::LowEmphasis ); outlinedButton2->setEmphasis( QskPushButton::LowEmphasis );
outlinedButton2->setText( "Outlined" ); outlinedButton2->setText( "low emphasis" );
auto* outlinedButton3 = new QskPushButton( this ); auto* outlinedButton3 = new QskPushButton( this );
outlinedButton3->setEmphasis( QskPushButton::LowEmphasis ); outlinedButton3->setEmphasis( QskPushButton::LowEmphasis );
outlinedButton3->setGraphicSource( "plus" ); outlinedButton3->setGraphicSource( "flight" );
addSpacer( 0 );
auto* textButton1 = new QskPushButton( this ); auto* textButton1 = new QskPushButton( this );
textButton1->setEmphasis( QskPushButton::VeryLowEmphasis ); textButton1->setEmphasis( QskPushButton::VeryLowEmphasis );
textButton1->setGraphicSource( "plus" ); textButton1->setGraphicSource( "local_pizza" );
textButton1->setText( "Text" ); textButton1->setText( "very low emphasis" );
auto* textButton2 = new QskPushButton( this ); auto* textButton2 = new QskPushButton( this );
textButton2->setEmphasis( QskPushButton::VeryLowEmphasis ); textButton2->setEmphasis( QskPushButton::VeryLowEmphasis );
textButton2->setText( "Text" ); textButton2->setText( "very low emphasis" );
auto* textButton3 = new QskPushButton( this ); auto* textButton3 = new QskPushButton( this );
textButton3->setEmphasis( QskPushButton::VeryLowEmphasis ); textButton3->setEmphasis( QskPushButton::VeryLowEmphasis );
textButton3->setGraphicSource( "plus" ); textButton3->setGraphicSource( "local_pizza" );
addSpacer( 0 );
auto* elevatedButton1 = new QskPushButton( this ); auto* elevatedButton1 = new QskPushButton( this );
elevatedButton1->setEmphasis( QskPushButton::HighEmphasis ); elevatedButton1->setEmphasis( QskPushButton::HighEmphasis );
elevatedButton1->setGraphicSource( "plus" ); elevatedButton1->setGraphicSource( "plus" );
elevatedButton1->setText( "Elevated" ); elevatedButton1->setText( "high emphasis" );
auto* elevatedButton2 = new QskPushButton( this ); auto* elevatedButton2 = new QskPushButton( this );
elevatedButton2->setEmphasis( QskPushButton::HighEmphasis ); elevatedButton2->setEmphasis( QskPushButton::HighEmphasis );
elevatedButton2->setText( "Elevated" ); elevatedButton2->setText( "high emphasis" );
auto* elevatedButton3 = new QskPushButton( this ); auto* elevatedButton3 = new QskPushButton( this );
elevatedButton3->setEmphasis( QskPushButton::HighEmphasis ); elevatedButton3->setEmphasis( QskPushButton::HighEmphasis );
elevatedButton3->setGraphicSource( "plus" ); elevatedButton3->setGraphicSource( "plus" );
addSpacer( 0 );
auto* tonalButton1 = new QskPushButton( this ); auto* tonalButton1 = new QskPushButton( this );
tonalButton1->setEmphasis( QskPushButton::VeryHighEmphasis ); tonalButton1->setEmphasis( QskPushButton::VeryHighEmphasis );
tonalButton1->setGraphicSource( "plus" ); tonalButton1->setGraphicSource( "sports_soccer" );
tonalButton1->setText( "Tonal" ); tonalButton1->setText( "very high emphasis" );
auto* tonalButton2 = new QskPushButton( this ); auto* tonalButton2 = new QskPushButton( this );
tonalButton2->setEmphasis( QskPushButton::VeryHighEmphasis ); tonalButton2->setEmphasis( QskPushButton::VeryHighEmphasis );
tonalButton2->setText( "Tonal" ); tonalButton2->setText( "very high emphasis" );
auto* tonalButton3 = new QskPushButton( this ); auto* tonalButton3 = new QskPushButton( this );
tonalButton3->setEmphasis( QskPushButton::VeryHighEmphasis ); tonalButton3->setEmphasis( QskPushButton::VeryHighEmphasis );
tonalButton3->setGraphicSource( "plus" ); tonalButton3->setGraphicSource( "sports_soccer" );
addSpacer( 0 );
} }
}; };