×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    100

    QML application on Portrait mode for MeeGo 1.2

    Good day everyone

    I'm using QtSDK 1.1.3 and used Qt Quick project to create a QML MeeGo 1.2 Harmattan project.

    When running the simple hello world app that is generated its ALWAYS on landscape mode no matter how the emulator is

    I've searched for quite sometime, and found out that people said if you use QML components, it should do the trick, and even found the following link http://harmattan-dev.nokia.com/docs/library/html/guide/html/Developer_Library_Best_practices_for_application_development_Controlling_rotation.html


    I've tried that, and I'm ALWAYS getting landscape mode all the time!!!

    did anyone have any WORKING example on how to create a portrait application in QML for MeeGo 1.2

    Please let me know if you have any ideas,

    Thanks a lot

    regards

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: QML application on Portrait mode for MeeGo 1.2

    Hi,
    If you create your application using the QtQuickProject > Harmattan Application, you get orientation support for free.
    You don't need any extra example...

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    22

    Re: QML application on Portrait mode for MeeGo 1.2

    I remember banging my head over a similar problem. Namely I had a QML with a Flipable as a root component and it would always lock to landscape, whereas I really wanted portrait.
    In the end, wrapping this thing into the following setup helped (and, as far as I've figured out, using PageStackWindow and Page components is pretty much the only way to control orientation on Harmattan so far).

    import QtQuick 1.1
    import com.meego 1.0 // This is needed for PageStackWindow

    PageStackWindow {
    showStatusBar: false
    showToolBar: false
    initialPage: mainPage
    Page {
    id: mainPage
    anchors.fill: parent
    orientationLock: PageOrientation.LockPortrait // <-- This is the magic line

    Flipable { .... } // Here went my original root component

    }
    }

  4. #4
    Registered User
    Join Date
    Feb 2008
    Location
    India, Nashik
    Posts
    816

    Re: QML application on Portrait mode for MeeGo 1.2

    I have a simillar question running sorry i just ignored this one, I and the original owner of this thread also probably want to use basic QML components and not harmattan, atleast i would like to port that app to S3 later without much efforts so need a solution which can run in general

    thanks
    Vishal

  5. #5
    Registered User
    Join Date
    Sep 2011
    Posts
    22

    Re: QML application on Portrait mode for MeeGo 1.2

    BTW another thing worth noting.
    It seems to me that no matter what you do, the application will always switch to landscape when the N950 keyboard is opened. This is not relevant for N9, but it is still fairly annoying.

  6. #6
    Registered User
    Join Date
    Feb 2006
    Posts
    100

    Re: QML application on Portrait mode for MeeGo 1.2

    Thanks for your reply

    I've tried this, and its STILL NOT working!!!
    I've tried it under Windows and Linux with QtSDK 1.1.3
    Windows 7 and Ubuntu 10.10

    This is the source code I'm using, is there any special settings that needs to be done in the .prj file or .pro file
    Code:
    import QtQuick 1.1
    import com.nokia.meego 1.0
    
    PageStackWindow {
        id: appWindow
    
        showStatusBar: false
        showToolBar: false
    
        initialPage: mainPage
    
        Page {
            id: mainPage
            anchors.fill: parent
            orientationLock: PageOrientation.LockPortrait
    
            Label {
                id: label
                anchors.centerIn: parent
                text: qsTr("Hello world!")
                visible: false
            }
    
            Button{
                anchors {
                    horizontalCenter: parent.horizontalCenter
                    top: label.bottom
                    topMargin: 10
                }
                text: qsTr("Click here!")
                onClicked: label.visible = !label.visible
            }
        }
    }
    main.cpp
    Code:
    #include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QmlApplicationViewer viewer;
        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
        viewer.setMainQmlFile(QLatin1String("qml/testHarmattan/main.qml"));
        viewer.showExpanded();
    
        return app.exec();
    }
    if you can send me a sample application that works ok from your device, it would be extremley helpful to see exactly what is causing this issue at my end.

    regards

  7. #7
    Registered User
    Join Date
    Sep 2011
    Posts
    22

    Re: QML application on Portrait mode for MeeGo 1.2

    * Upgrade to the latest QtCreator (mine is 2.2.1 but there is a 2.3rc now, perhaps it will be even better).
    * Do a "New project -> QtQuick project -> Harmattan application"
    * Add a "pageOrientation" to the MainPage.qml of that project. Things will work then (at least they work on my N950). The only exception is sliding out the keyboard which will force your page to landscape no matter what you do.

    I tried your code and it worked fine for me when I changed main.cpp to the following:

    Code:
    #include <QtGui/QApplication>
    #include <QtDeclarative>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QDeclarativeView view;
        view.setSource(QUrl("qrc:/qml/main.qml"));
        view.showFullScreen();
    
        return app.exec();
    }

  8. #8
    Registered User
    Join Date
    Feb 2006
    Posts
    100

    Re: QML application on Portrait mode for MeeGo 1.2

    I'm using the LATEST SDK with the latest Qt Creator, and I've done the Harmattan application from new project, and I'm still getting exactly the same problem.

    What is your OS that you are running, it might be a problem with the OS, I use Windows 7 Professional 32bit. I will try to compile again Windows xp professional under VMWare and see if that makes any difference.

    Thanks!

  9. #9
    Registered User
    Join Date
    Sep 2011
    Posts
    22

    Re: QML application on Portrait mode for MeeGo 1.2

    I have Windows 7 Professional but I really doubt this has anything to do with the landscape/portrait thing on the phone.

Similar Threads

  1. Help: how to use WRT only in Portrait mode?
    By gomcoite in forum Symbian
    Replies: 3
    Last Post: 2011-02-18, 22:55
  2. portrait / landscape mode in application
    By mando7stam in forum Qt
    Replies: 14
    Last Post: 2010-08-26, 15:48
  3. Fix portrait mode in N97 fw v.20
    By diegoves in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2009-11-16, 12:00
  4. How to force application always to stay in portrait mode?
    By wojciech.debowski in forum Symbian
    Replies: 4
    Last Post: 2008-05-16, 08:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×