Unsolved Move a QLabel through a QGridLayout
-
Hello!
I am making an app that includes a doubleSlider. Under it, I have to QLabels that show the slider handler values. That I want to do is move this labels to the handlers position, like it shown in the images:
That I have:
That I want:
I have connected the valuesChanged(double, double) signal to this slot, but it doesn't work. The QLabels are in a QGridLayout:
void settings::updateValues(double valueMin, double valueMax) { ui->minBeep->setText(QString::number(valueMin, 'f', 0)); ui->maxBeep->setText(QString::number(valueMax+1, 'f', 0)); double posMin, posMax; posMin = ((m_pSliderDoble->geometry().width() * valueMin) / m_pSliderDoble->maximumValue()); posMax = ((m_pSliderDoble->geometry().width() * valueMax) / m_pSliderDoble->minimumValue()); ui->minBeep->move(posMin, 0); ui->maxBeep->move(posMax, 0); }
Any help with it?
Thank you very much!
-
Hi
You cannot use move when they are controlled by a layout. -
@mrjj And.. Is there any other way to do it?
-
@ivanicy
Dont use a layout / put the labels in the layout ?
Or paint the values with the handles ?ps. Nice double slider :)
Is it a custom control ? -
@mrjj In this list you can find the doubleSlider classes:
ctkDoubleRangeSlider.cpp
ctkDoubleSlider.cpp
ctkRangeSlider.cpp
https://github.com/commontk/CTK/tree/master/Libs/WidgetsAnd this other:
ctkValueProxy.cpp
https://github.com/commontk/CTK/tree/master/Libs/Core -
Ok, seems like nice collection.