26 QHBoxLayout *layout =
new QHBoxLayout();
27 layout->setContentsMargins( 0, 0, 0, 0 );
28 layout->setSpacing( 3 );
31 mSlider =
new QSlider();
32 mSlider->setMinimum( 0 );
33 mSlider->setMaximum( 1000 );
34 mSlider->setSingleStep( 10 );
35 mSlider->setPageStep( 100 );
36 mSlider->setValue( 1000 );
37 mSlider->setOrientation( Qt::Horizontal );
38 layout->addWidget( mSlider, 1 );
41 mSpinBox->setMinimum( 0.0 );
42 mSpinBox->setMaximum( 100.0 );
43 mSpinBox->setValue( 100.0 );
45 mSpinBox->setMinimumSize( QSize( 100, 0 ) );
46 mSpinBox->setDecimals( 1 );
47 mSpinBox->setSuffix( tr(
" %" ) );
48 layout->addWidget( mSpinBox, 0 );
50 setFocusProxy( mSpinBox );
52 connect( mSlider, &QSlider::valueChanged,
this, [ = ](
int value ) { mSpinBox->setValue( value / 10.0 ); } );
53 connect( mSpinBox,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
double value ) {
whileBlocking( mSlider )->setValue( value * 10 ); } );
54 connect( mSpinBox,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, &QgsOpacityWidget::spinChanged );