Hi Damian,

On Dec 6, 2013, at 11:58 AM, Damian Ivanov 
<damianator...@gmail.com<mailto:damianator...@gmail.com>> wrote:

I have a question regarding the Slider element form Controls:
                   Slider {
                       minimumValue: 30
                       maximumValue: 100
                       stepSize: 1
                       value: mySettings.myValue
                   }
should myValue by updated when I slide the slider? Because my value
does not. I need to add
                       onValueChanged: mySettings.myValue = (value)
which results in a binding loop. What is the proper way to do it?

Yes, this is normal. Bindings only work in one direction.

What you want to do is,

mySlider.value = mySettings.myValue

where ‘mySlider’ is the slider above. You should do this when both the slider 
and your settings object are complete.

To update the settings, you can do it continuously with, e.g., a binding object,

Binding {
target: mySettings
property: “myValue”
value: mySlider.value
}

or only once, when you want to save your settings. For instance,

onSaveSettingsNow: mySettings.myValue = mySlider.value

where ‘saveSettingsNow’ is some signal you emit at the right moment.

Best regards,

Dr. Gabriel de Dietrich
Senior Software Developer
qt.digia.com<http://qt.digia.com>

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to