September 20, 2011

developer 123 developer 123
Lab Rat
8 posts

N950, Qt C++ app (not QML,QtQuick!), screen orientation is locked to landscape mode.

 

I have the latest QtSDK, trying to create QT Widget Project -> Mobile Qt Application -> Harmattan device – build and launch application on N950, application is displayed only in landscape mode. I need to use my QWidget in portrait orientation. The QWidget::setAttribute(Qt::WA_LockPortraitOrientation) does not work. I found also related bugreport: https://bugs.meego.com/show_bug.cgi?id=17200

Any workaround I can use to solve my problem? So far I can see one ugly solution: use landscape mode as it is, but rotate all graphics 270 degrees, so user can see app properly in portrait mode. But I am afraid that bug might be fixed into final N9 firmware and all my app graphic will be wrongly rotated on N9.
Any ideas?

10 replies

September 20, 2011

deion deion
Lab Rat
52 posts

Yeah, I am in the same situation as you; I tried supporting portrait mode for my app, and I’m using a Nokia N950 to test the app; after researching this issue (portrait orientation in MeeGo Harmattan) I found out that the solution is actually a “hack”, as you describe it (“use landscape mode as it is, but rotate all graphics 270 degrees”). This doesn’t look right to me, so I decided not to support portrait orientation in the end; I believe a proper solution should be given to this issue, and not this “hack”.

September 20, 2011

Alicemirror Alicemirror
Lab Rat
717 posts

Hello, the hcack is high risk I think because this problem of the orientation depends on a sort of bug on the device.
The problem is that setting in Qt the orientation seems working bad and the orientation should be forced again in QML.

Please try to reflash the new version Beta 2 on N950 (link is here: https://www.developer.nokia.com/info/sw.nokia.com/id/db230178-aa63-4c73-ba7f-20930da13cad/Nokia_N950_OneClickFlashers.html ) and see if this problem is already present.

 Signature 

Enrico Miglino (aka Alicemirror)
Tech Consulting
Islas Baleares, Ibiza (Spain)
http://www.contesti.eu

September 20, 2011

developer 123 developer 123
Lab Rat
8 posts

I found more info which will lead to more problems related to fail in QA while submitting to OVI for N9:
http://www.developer.nokia.com/Community/Blogs/blog/aleksandr-trufanovs-forum-nokia-blog/2011/08/13/harmattan-orientation

“your portrait app could be closed by wrong (landscape) swipe direction and you will fail the Nokia Store QA process with something like that:

SUMMARY: The application close when trying to suspend the application to the background.
STEPS TO REPRODUCE:
1. Download the content OTA。
2. Install and launch the content.
3. Suspend the application in the backgroung by swiping the screen form right to left.
ACTUAL RESULT: The application close.
EXPECTED RESULT: The application should not close when minimizing the application to recents by swiping: Left-Right, Right-Left, Down-Top. For Portrait applications, swiping from Top-Down should close the application and it should not appear in recents. For Landscape applications, swiping the device from Top-Down while holding the device in Landscape should close the application and it should not appear in recents.
AFFECTED DEVICES: N9 Firmware: xxx”

N950 does not have “Top slide closes the application” setting, neither I cannot test it. Seems like N9 will have one.
It is sounds like a big problem :-(

September 20, 2011

Alicemirror Alicemirror
Lab Rat
717 posts

Despite that the protrait / landscape management will be a problem for Nokia ( a demonstration of this is that the QEMU shows always the buttons in portrait but your application runs in landscape only) to be honest this seems a report of the qualitycheck of Ovi. If the application closes swiping (portrait or landscape) this means that something is managed wrong in the application. I am almost sure.

 Signature 

Enrico Miglino (aka Alicemirror)
Tech Consulting
Islas Baleares, Ibiza (Spain)
http://www.contesti.eu

September 20, 2011

Alicemirror Alicemirror
Lab Rat
717 posts

I have checked now. My application manages the orientation from QML and forces it to portrait.

With any rotation you impose to the device, swiping to any side the current application is put in background. And my app doesn’t rotate at all.

 Signature 

Enrico Miglino (aka Alicemirror)
Tech Consulting
Islas Baleares, Ibiza (Spain)
http://www.contesti.eu

September 20, 2011

developer 123 developer 123
Lab Rat
8 posts

Alicemirror wrote:

With any rotation you impose to the device, swiping to any side the current application is put in background.

Are you talking about N9 phone or N950? I guess that N9 have extra setting like “Close app by swipe from top down”, and that would fail QA tests if app will be closed by system while swipe from right to left. Correct me if I am wrong. I have N950, I cannot test it on my device.

September 20, 2011

developer 123 developer 123
Lab Rat
8 posts

I just flashed device with new Beta2 firmware, now I have in Settings – Device the new option “Swipe down to close app”, when it is enabled, then all built-in application closing fine when I do swipe down, but applications downloaded from Ovi Store (e.g. “Level”) are closed when I do swipe from right to left and goes to background for swipe down (however screen is in portrait orientation). This is weird. I assume if I will submit my app to ovi from now, it will fail the QA tests in this condition. :-(

September 20, 2011

Alicemirror Alicemirror
Lab Rat
717 posts

I answer only now because I have reflashed the firmware in this moment.

@developer123: the question is: if the application is forced to work with one orientation, and the close the application with swipe is set, so the left ad up ecc. sides should be considered with the application in that position.

Remain to check if the application manages the correct orientation locks form inside the applicaiton while not using the QML documents.
Then, I think that if you think that your application will work correctly and you have not setup any special behavior like intercept a particular swipe direction to close it (that is not permitted as the Ovi Store directives) you can submit the application to Ovi Store.
I have experienced that most of the tricks and problems are surely clear when them test che application. It is a bit annoying the submission process, wait the resopnse tec, but it is userful to experience if your application really follow their directives or not.

 Signature 

Enrico Miglino (aka Alicemirror)
Tech Consulting
Islas Baleares, Ibiza (Spain)
http://www.contesti.eu

September 20, 2011

developer 123 developer 123
Lab Rat
8 posts

2Alicemirror: thanks for help, I will try to investigate with new firmware what I can do. But in general, the question around orientation control is still open. About QA “swipe close” requirements I will try to ask ovi support team, maybe they can give me official info about testing rules.
If you find any valuable info, I will appreciate, if you post it here. Thanks

November 3, 2011

luca_moller luca_moller
Lab Rat
1 posts

Alicemirror, could help me? I can’t set lock my app orientation. How did you do it with QML? I’m not used to QML (I didn’t used it in my qt app before). I’m trying to do the following:

  1. QScopedPointer<QApplication> app(createApplication(argc, argv));
  2. QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
  3. viewer->setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
  4. viewer->setMainQmlFile(QLatin1String("qml/TesteOrientation/main.qml"));
  5. viewer->showExpanded();

But it is not working (the orientation is not being locked and still changes to landscape when I rotate the device)

Thanks!

EDIT:
Just solved it, the solution was to include the following line in the QML page:

  1. orientationLock: PageOrientation.LockPortrait

 
  ‹‹ [Solved]What is the best way to "fix" a ListView flick?      QML physical keyboard open/closed detection and correct VKB usage for TextInput ››

You must log in to post a reply. Not a member yet? Register here!