0

I have created a slider for a mediaplayer application in QML. The value property of the slider is updated by a thread in the background. My issue is that when the slider is dragged to do a seek,even though a seek action has been done and new value for the slider is updated by dragging, when the mouse is released, the handle jumps to its previous position before coming to the new position. I created the slider using the code below

Slider {
    id: sliderHorizontal
    x: 145
    y: 478
    visible:  false
    activeFocusOnPress:true
    maximumValue: 100.0
    minimumValue: 0.0
    updateValueWhileDragging :true
    value: Media.SliderValue

    onValueChanged: {
        //seek to the new value calling a c++ function
    }
} 

Can anyone guess why the slider is going back even though the background thread that updates the value is also updating to a new position ?

BaCaRoZzo
  • 7,502
  • 6
  • 51
  • 82
  • 1
    You should provide a minimal code, there's no "guessing" here to do. Do not use absolute positioning, use anchors/layouts instead. As for the specific code: what do you do in the `onValueChanged`? Generally, it does not make a lot of sense to update the value of a property inside its `onChanged` handler (assuming that's what you are doing). – BaCaRoZzo Jan 07 '16 at 13:18
  • Thanks for the suggestion. In the handler, I am invoking a method added as Q_INVOKABLE to perform a seek action. The method call is successful and the playback does advance. Only thing is the slider goes to previous position before coming to the new position – Gokul Krishnan Jan 07 '16 at 13:38
  • It sounds like you are in a loop between C++ and QML. but I'm just guessing here. – BaCaRoZzo Jan 07 '16 at 13:41
  • Yes...The QML side is pretty dump. All action is in C++ – Gokul Krishnan Jan 07 '16 at 13:45

0 Answers0