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

QML noob question: Alter default bool

asked 2019-05-17 22:08:09 +0300

Sunny gravatar image

updated 2019-05-17 22:18:32 +0300

Hello,

unfortunately I know exactly nothing about QML. Syntax isn't completely cryptic to me, but I'm stuck finding out where some kind of initialization happens after declaration (which I think I found - if one can compare runtime prototype definition and variable declaration... sorry for this ugly blending, I don't speak QML or any other object oriented language well/at all).

So I see that e.g. DisplaySettings.lidSensorEnabled is true by default, as opposed to DisplaySettings.lowPowerModeEnabled.

I guess the setting is predefined in lib/libsystemsettings.so, so at compile time. Is there a way to change the bool at system startup time?

Thanks, -harry

edit retag flag offensive close delete

Comments

1 Answer

Sort by » oldest newest most voted
3

answered 2019-05-18 08:43:37 +0300

spiiroin gravatar image

Under the hood DisplaySettings.lidSensorEnabled is mapped to mce setting, i.e. toggling the bool value from qml does the same thing as running mcetool from cli:

mcetool  --set-lid-sensor-mode=<enabled|disabled>

Note that the value persists over application / device restarts. The initial value of the QML property should reflect whatever the underlying setting value is, i.e. it is not always True by default.

edit flag offensive delete publish link more

Comments

Thanks a lot, very valuable insight :-)

I know that there is 'mcetool' and where it comes from, but nothing about the real "backend" nor integration. But this explains my observations. Will use it to do my desired altering.

Sunny ( 2019-05-20 09:23:37 +0300 )edit

@Summy: qt/qml <--dbus--> mce happens here: https://git.merproject.org/mer-core/nemo-qml-plugin-systemsettings/blob/master/src/displaysettings.cpp

The way it works is roughly:

  1. Hard coded "sane enough" values are set up from constructor
  2. Async dbus query is started to get actual settings from mce
  3. Upon getting a reply, setting values are updated and finally "populated" property is set to true

Which basically means: If you really want/need to ignore short living blibs caused by delta between assumed and actual values, it can be done by not acting on setting values while populated is false.

spiiroin ( 2019-05-20 10:51:06 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2019-05-17 22:08:09 +0300

Seen: 188 times

Last updated: May 18 '19