We have moved to a new Sailfish OS Forum. Please start new discussions there.

ProgressBar in Lockscreen

asked 2015-01-24 17:14:57 +0300

ZioBilly gravatar image

updated 2015-07-29 23:33:30 +0300

chemist gravatar image


I uploaded the patch on openrepos, feel free to make suggestions and report bugs :)


Hi, i'm trying to implement a ProgressBar in the Lockscreen to show Battery charge.

i managed to obtain something funcional with this piece of code:

    ProgressBar {
        id: batteryProgressBar
        anchors {
            left: parent.left
            bottom: parent.bottom
        width: Screen.width
        minimumValue: 0
        maximumValue: 100
        value:  batteryChargePercentageContextProperty.value
        label: batteryChargePercentageContextProperty.value

The problem is that i want it to change color like other items in Low Power Mode, other items use this line to adapt to LPM

color: lockScreen.textColor

but i don't know how to change colors of this progressbar

Instead i tried to implement it like this: https://github.com/dm8tbr/sailfishsilica-qt5/blob/master/usr/lib/qt5/qml/Sailfish/Silica/ProgressBar.qml

In this way i can set the colors to behave properly in LPM, but i can't get it to display the right value and the status "indeterminate"

I'm just a beginner with programming, so i need some help, i hope this is the right place

edit retag flag offensive close delete


I am a beginner as well and can only offer this possible snippet of info, which may help, the following is not a suggestion but an idea of how the command may look (just guessing, based on my limited experience of building ambience).

Perhaps something like this - color: Theme.primaryColor or color: Theme.highlightColor (where 'primary' affects time colour and 'highlight' affects operator/date/day/year), this applies when making ambience, so I figured it may be the same or similar parameters you need to set.


Spam Hunter ( 2015-01-24 18:33:05 +0300 )edit

The problem is that progressbar does not have a color property, but the color is set inside a private property i guess, which i don't know how to find

ZioBilly ( 2015-01-24 19:00:08 +0300 )edit

Interesting thread, hope u get it sorted out. Could u share how do you get something like ProgressBar or any QML-component/element to be shown in LockScreen / LPM-(glance)-screen from 3rd-party or user app. Is there a Harbour conpliant way of doing this or does this require editing system QML-files directly?

foss4ever ( 2015-01-25 01:58:04 +0300 )edit

Well i edited some qmls, and that is how most patches like the one in patchmanager works. Once you know how these files works you can do basically anything, is a bit risky to edit the lockscreen qml because it can cause the lockscreen to crash, it's advisable to keep a backup of the files you edit though.. As i said i'm a real beginner, so i basically look how things works and copy and paste something and see if it still works.

However i noticed that the "indeterminate" status of the progressbar doesn't work as expected, i think there is some problem with time on the lockscreen

ZioBilly ( 2015-01-25 13:13:35 +0300 )edit

Have you tried testing with the emulator coming together with the SDK? It would be less risky then.

lakutalo ( 2015-01-30 21:04:04 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-01-26 00:08:04 +0300

ZioBilly gravatar image

updated 2015-01-26 00:08:52 +0300

I think i managed to solve the problem, i recreate a new progressbar item, it glows when charging. I will test it for some days (because i'm not sure yet of the funcionality of the glowing) then i think i'll create a patch for those who are intrested in

image descriptionimage description

I'm sorry for the very big pictures...

edit flag offensive delete publish link more


Interesting work! :)

Spam Hunter ( 2015-01-26 00:46:51 +0300 )edit

Cool, indeed ;)

foss4ever ( 2015-01-26 01:15:15 +0300 )edit

eagerly waiting for your patch! nice work!

velimir ( 2015-01-26 01:58:50 +0300 )edit

Well done!

laubblaeser ( 2015-01-27 03:04:26 +0300 )edit

Well done indeed! I'm interested.

tasuri ( 2015-01-30 10:11:29 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2015-01-24 17:14:57 +0300

Seen: 631 times

Last updated: Jan 30 '15