I have a Widgets with LineEdit 's to set some int values. To make that easier, I have an additional QToolButton which shall show a QSlider to modifiy that value.
IMPORTANT: The Slider is intially hidden! It shall only appear if the Button was pressed. When I have 20 slidersWidgets in a row, I would waste the space for each of them, if put in a predefined layout. If the space is not required until popup, window adjustments would be required then.
The screenshot represents on ValueSelectorWidget. I have multiple of them listed.
In the ValueSelectorWidget class I have:
valveSlider = new QSlider(Qt::Horizontal, this);
As you can see on the screen shot, when I click on the left ToolButton, a QSlider appears.
On the top left side of the ValueSelectorWidget because of the this
in the QSlider object cration above.
How can I place that slider arround of the left ToolButton (sliderButton) ?
QPoint sliderButtonPos = sliderButton->pos();
sliderButtonPos.rx() + 50 ;
sliderButtonPos.ry() + 50;
valveSlider->setGeometry(sliderButtonPos.x(), sliderButtonPos.y(), 120, 20);
As in the following : When I press the red dot button, the Slider shall appear next to it or next to the current mouse position.
But that did not work either. Any suggestions? Thanx in advance.