Sry again, it worked, but now Slider {id:opacitySlider; minimumValue:30; maximumValue:100; stepSize:1; } Binding {target:testSettings; property:"testOpacity"; value:opacitySlider.value} } this works no loop, but the slider is by default set to 0.0 but the initial value should represent: testSettings.testOpacity
How is that achieved? 2013/12/6 Damian Ivanov <damianator...@gmail.com>: > Hi Gabriel, > > Thanks! Worked perfectly :) > > 2013/12/6 deDietrich Gabriel <gabriel.dedietr...@digia.com>: >> Hi Damian, >> >> On Dec 6, 2013, at 11:58 AM, Damian Ivanov <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 >> >> >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest >> _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest