I want to put a custom image as the handle displayed in QSlider. I am using the following style sheet code:

Qt Code:
  1. QSlider::handle:horizontal {
  2. image: url(images/track-marker.png);
  3. margin: -4px 0;
  4. }
To copy to clipboard, switch view to plain text mode 

The above code works but the problem is that the directory where the handle image is located is not fixed. So, in the source code, i can get the directory location but i don't know how to pass that location to the style sheet.

Is there any other way that through source code, i can set the handle image? One more thing, i am using style sheet to fill the groove color and other variables so style sheet will still be used along with the code.