Dial constant update
-
Hi, complete beginner here.
In my project I have a dial and a text object. Basically I want the text box to update and display the value of the dial when the dial is used. The code i have works, to a certain extent, however the the text box only updates AFTER the dial stops moving. I want it to give constant feedback to the user on what value they are selecting.So i am using:
dial1.onValueChanged : { text1.text = dial1.value; }
My question is which implementation of dial1 will constantly update the text1 with the value WHILE the dial is moved?
Thanks very much
-
@amygdata
Have you tried with http://doc.qt.io/qt-4.8/qabstractslider.html#sliderPosition-prop ? -
Thanks - would you mind giving me some example code to add to what I have already? I am really just starting out. Really appreciate it.
-
@amygdata
when the sliderMoved() signal is emitted you make a slot to to hold the position of dial on to the text box. -
Sorry , i'm confused - how do I link the slider to the Dial? The dial doesn't have a slidermoved property?
-
@amygdata
I Do not know QML .I did this way works for me .
connect(ui->dial,SIGNAL(sliderMoved(int)),this,SLOT(sliderValueChanged(int))); void MyClass::sliderValueChanged(int position) { ui->lineEdit->setText(QString::number(position)); }