Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook
Accepted Solution

How to prevent screen to dim

I'm writing an Application which needs to disable the screen dimming. How can I do that in C/C++?
Developer
guru2000at
Posts: 101
Registered: ‎02-25-2011
My Device: Playbook, q5, z10

Re: How to prevent screen to dim

https://bdsc.webapps.blackberry.com/native/documentation/com.qnx.doc.native_sdk.devguide/com.qnx.doc... Have look at the docs
________________
mappau Dev Team
blackberry@mappau.com
twitter: mappau
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook

Re: How to prevent screen to dim

Is this also possible in Qt? Cause I didn't have a screen-object.
New Contributor
weidongxu
Posts: 7
Registered: ‎04-06-2012
My Device: Playbook

Re: How to prevent screen to dim

See if you can do this:

WId winId = window.winId();
if (winId)
{
int zorder = layer;
screen_set_window_property_iv(screen_window_t(winId), SCREEN_PROPERTY_ZORDER, &zorder);
}

Make sure "window" is a top level QWidget. From the code in the bb plugin, this its winId should be the native handle.
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook

Re: How to prevent screen to dim

Thank you very much. It's working!!

 

I used the QMainWindow of my App.

 

WId winId = this->mainWindow->winId();
if( winId != NULL )
{
  int idleMode = SCREEN_IDLE_MODE_KEEP_AWAKE;
  screen_set_window_property_iv( screen_window_t(winId), SCREEN_PROPERTY_IDLE_MODE, &idleMode);
}