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.
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”.
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.
I found more info which will lead to more problems related to fail in QA while submitting to OVI for N9:
“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 :-(
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.
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.
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. :-(
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.
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
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:
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
But it is not working (the orientation is not being locked and still changes to landscape when I rotate the device)
Just solved it, the solution was to include the following line in the QML page:
- orientationLock: PageOrientation.LockPortrait