code adjusted to M3 wordings

This commit is contained in:
Uwe Rathmann 2024-10-22 15:45:09 +02:00
parent c3b3da2ad3
commit 963f0aff27
1 changed files with 46 additions and 19 deletions

View File

@ -15,24 +15,43 @@ namespace
class Slider : public QskSlider class Slider : public QskSlider
{ {
public: public:
enum Style
{
Continous,
Discrete,
Centered
};
Slider( Qt::Orientation orientation, Slider( Qt::Orientation orientation,
bool snap, QQuickItem* parent = nullptr ) Style style, QQuickItem* parent = nullptr )
: QskSlider( orientation, parent ) : QskSlider( orientation, parent )
{ {
setBoundaries( 0, 100 ); setBoundaries( 0, 100 );
setValue( 30 ); setValue( 30 );
setSnap( snap ); switch( style )
{
case Discrete:
{
setSnap( true );
setStepSize( 5 );
setPageSteps( 4 );
if ( snap ) break;
{ }
setStepSize( 5 ); case Continous:
setPageSteps( 4 ); {
} setSnap( false );
else setStepSize( 1 );
{ setPageSteps( 10 );
setStepSize( 1 );
setPageSteps( 10 ); break;
}
case Centered:
{
// TODO
break;
}
} }
#if 0 #if 0
@ -75,11 +94,19 @@ namespace
InputPage::InputPage( QQuickItem* parent ) InputPage::InputPage( QQuickItem* parent )
: Page( Qt::Horizontal, parent ) : Page( Qt::Horizontal, parent )
{ {
auto sliderH = new Slider( Qt::Horizontal, false ); struct
auto discreteSliderH = new Slider( Qt::Horizontal, true ); {
Slider* continous;
Slider* descrete;
} sliders[2];
auto sliderV = new Slider( Qt::Vertical, false ); for ( int i = 0; i < 2; i++ )
auto discreteSliderV = new Slider( Qt::Vertical, true ); {
const auto orientation = static_cast< Qt::Orientation >( i + 1 );
sliders[i].continous = new Slider( orientation, Slider::Continous );
sliders[i].descrete = new Slider( orientation, Slider::Discrete );
}
auto spinBox = new QskSpinBox( 0.0, 100.0, 1.0 ); auto spinBox = new QskSpinBox( 0.0, 100.0, 1.0 );
spinBox->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed ); spinBox->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
@ -91,15 +118,15 @@ InputPage::InputPage( QQuickItem* parent )
vBox->setSpacing( 30 ); vBox->setSpacing( 30 );
vBox->setExtraSpacingAt( Qt::RightEdge | Qt::BottomEdge ); vBox->setExtraSpacingAt( Qt::RightEdge | Qt::BottomEdge );
vBox->addItem( sliderH ); vBox->addItem( sliders[0].continous );
vBox->addItem( discreteSliderH ); vBox->addItem( sliders[0].descrete );
vBox->addItem( inputBox ); vBox->addItem( inputBox );
vBox->addItem( spinBox ); vBox->addItem( spinBox );
auto mainBox = new QskLinearBox( Qt::Horizontal, this ); auto mainBox = new QskLinearBox( Qt::Horizontal, this );
mainBox->setSpacing( 30 ); mainBox->setSpacing( 30 );
mainBox->addItem( sliderV ); mainBox->addItem( sliders[1].continous );
mainBox->addItem( discreteSliderV ); mainBox->addItem( sliders[1].descrete );
mainBox->addItem( vBox ); mainBox->addItem( vBox );
auto inputs = findChildren< QskBoundedValueInput* >(); auto inputs = findChildren< QskBoundedValueInput* >();