@felixli,
It is quite simple, you can set the value of the Slider to whatever the value it had last.
AND you the halfway reset is because of setting the currentValue to 50 and then setting the slider to that value.
I am not sure where this reference is from, but this should be good for you to start.
cheers,