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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

New Contributor
Posts: 6
Registered: ‎02-07-2013
My Device: Playbook
My Carrier: none
Accepted Solution

Screen rotation (displayDirection) in non cascades (QtQuick) app

[ Edited ]

Hi all,


I am new to BB, but have Qt/ Qt Quick experience.


I am trying to port my Qt Quick app to BB10. The app is SmartCam: http://sourceforge.net/projects/smartcam/


I am using camera apis but no cascades. I am having issues with the camera viewfinder and the orientation of my UI.


I am requesting BB10 to support only landscape orientation for my app like this:

1) in bar-descriptor.xml:


 2) in main.cpp:

    QmlApplicationViewer qmlViewer;
 qmlViewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); // ORIENTATION

This is OK, my app starts in landscape and does not rotate to portrait when the device orientation changes (actually a few times the app started in portrait but only 0.5%; this is not my main issue).


My problem is that even though it starts in landscape, sometimes the displayDirection (the name of this is taken from the cascades OrientationSupport class) is different: sometimes the Blackberry logo text displayed briefly while my app starts is pointing up (80%) and sometimes it's pointing down (20%).


I need to specify an angle to the camera viewfinder based on the value of the displayDirection (either 90 degrees or 270) but I have no way that I know of to query the value of this param, because the cascades OrientationSupport is not available to a Qt Quick app,it gives me linking errors:

undefined reference to `bb::cascades::OrientationSupport::instance()'

 I added this in the .pro file:

LIBS += -lcamapi -lscreen -lbtapi -ljpeg -lbps

but did not help.


The RotationCamera sample is also using the OrientationSupport class so it's not of much help to me.


I also tried this in main.cpp:

    // Disable screen power down
    int idle_mode = SCREEN_IDLE_MODE_KEEP_AWAKE;
    WId winId = glWidget->winId();
    screen_set_window_property_iv(screen_window_t(winId), SCREEN_PROPERTY_IDLE_MODE, &idle_mode);
    int angle = 0;
    screen_set_window_property_iv(screen_window_t(winId), SCREEN_PROPERTY_ROTATION, &angle);
    winId = qmlViewer.winId();
    screen_set_window_property_iv(screen_window_t(winId), SCREEN_PROPERTY_ROTATION, &angle);

But setting SCREEN_PROPERTY_ROTATION did not help either ....


Because of this issue my app was rejected form AppWorld.


Can anyone help?




New Contributor
Posts: 6
Registered: ‎02-07-2013
My Device: Playbook
My Carrier: none

Re: Screen rotation (displayDirection) in non cascades (QtQuick) app

Fixed it by calling

navigator_set_orientation(NAVIGATOR_LEFT_UP, NULL);

in response to the bps navigator event: NAVIGATOR_WINDOW_ACTIVE


That way my app will always start in landscape (that was also happening before) but the display direction will be constant at start up.