I am planning to make an app which would switch between Light and Dark theme based on the ambient light conditions. So if it was a dark room, then the app would switch to a dark theme to reduce the strain on the eye and provide a pleasant experience.

I looked into Qt LightSensor API Docs here but on trying it on a sample device didnt work as expected. I also made sure to add sensors to the apparmor file. Has anyone got this working?

I would appreciate if the answer could include a working code.

2 Answers 2


It's indeed not yet hooked up to the backend yet (atm you can only get such sensor events using the platform-api directly). I included a story in the Phone Foundations backlog to hook this into Qt.


This would be the appropriate API I guess, however, it doesn't seem to be hooked up to the backend yet. At least for me right now it it seems to give random values.


I think a bug report might be appropriate at this point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.