Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User Jon Heron's Avatar
    Join Date
    Feb 2010
    Posts
    210
    Hello All,
    I am porting my symbian qml apps to meego. In order to enable auto orientation it seems I need to use the pageStack element instead of the loader element I am currently using.
    What I have currently is a listview in main.qml that loads all the qml modules (using the loader element) depending on whats selected from the list.
    I am getting confused about how to initialize the main.qml as the initial page on the stack.
    Should I be creating a new window that pushes main.qml onto the stack or should I be pushing the listview itself as the initial window from main.qml?
    I know this is a basic question, I am just not "getting it"
    Thanks for any insight or guidance!
    Cheers,
    Jon

  2. #2
    Nokia Developer Champion vineet.jain's Avatar
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,841
    You can call main.qml from project's main.cpp only :

    Code:
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QmlApplicationViewer viewer;
        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
        viewer.setMainQmlFile(QLatin1String("qml/fff/main.qml"));
        viewer.showExpanded();
    
        return app.exec();
    }
    Create a pagestack in the main.qml & initialize from it the initial page of the application(in your case the listview):

    Main.qml:

    Code:
    import QtQuick 1.1
    import com.nokia.meego 1.0
    
    PageStackWindow {
        id: appWindow
    
        initialPage: mainPage
    
        XYZListingPgae{                           /// XYZListingPage is the ListView qml
            id: mainPage
        }

  3. #3
    Registered User Jon Heron's Avatar
    Join Date
    Feb 2010
    Posts
    210
    Thanks
    So I will need to move the content of the current main.qml, the listview, to a separate qml file that I push to the stack...
    Got it!
    Cheers,
    Jon

  4. #4
    Registered User Jon Heron's Avatar
    Join Date
    Feb 2010
    Posts
    210
    OK, I have implemented the pagestack and it seems to be working fine, except for what I wanted it for! Now the orientation is locked in portrait and wont rotate automatically like expected.
    Here is what I have in main.qml
    Code:
    import QtQuick 1.1
    import com.nokia.meego 1.0
    
    PageStackWindow {
        id:mwindow
        width: 1000
        height:1000
        initialPage: recMain
        
    Rectangle
    {
        id: recMain
      anchors.fill: parent
    .....
    }
    }
    Here is my main.cpp
    Code:
    #include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"
    #include <QDeclarativeEngine>
    #include <QDeclarativeContext>
    #include <QSettings>
    #include "settings.h"
    
    Q_DECL_EXPORT int main(int argc, char *argv[])
    {
        QScopedPointer<QApplication> app(createApplication(argc, argv));
        app->setOrganizationName("SnappyAppz");
        app->setOrganizationDomain("snappyappz.com");
        app->setApplicationName("E-Calc");
        Settings* settings = new Settings(app.data()); //for qsettings wrapper
        //set up settings file in corect path on the particular device
        QString str = app->applicationDirPath(); //returns path of app exe
        settings->setPath(QSettings::NativeFormat, QSettings::UserScope, str);
    QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
        viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
        viewer->rootContext()->setContextProperty("Settings", settings);
        viewer->setMainQmlFile(QLatin1String("qml/ec/main.qml"));
        viewer->showExpanded();
        return app->exec();
    }
    Anybody have any advice as to why it wont rotate automatically?
    Cheers,
    Jon

  5. #5
    Regular Contributor alasriv's Avatar
    Join Date
    Mar 2008
    Posts
    53
    If you have below statement in your pro file, please remove and check
    Avoid auto screen rotation
    DEFINES += ORIENTATIONLOCK

  6. #6
    Nokia Developer Champion vineet.jain's Avatar
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,841
    Also do check in device as well if you are not already doing so, as there have instances when the orientation issue exists only with meego emulator.

  7. #7
    Registered User Jon Heron's Avatar
    Join Date
    Feb 2010
    Posts
    210
    Thanks!
    Yes it rotates fine on Qemu and over the RDA, its just on the sim that it wont rotate! Its all working now and the port is complete.
    Cheers,
    Jon

Similar Threads

  1. pageStack vs pageStackWindow element
    By Tslv in forum [Archived] Qt Quick
    Replies: 10
    Last Post: 2012-01-20, 12:08
  2. C++/Qml communication and pageStack
    By pixsta in forum [Archived] Qt Quick
    Replies: 3
    Last Post: 2011-12-27, 12:26
  3. PageStack pop transition animation
    By HellStranger in forum Russian Developer Forum - Форум Российских разработчиков
    Replies: 4
    Last Post: 2011-12-13, 12:44
  4. PageStack transition animation
    By HellStranger in forum Nokia N9
    Replies: 8
    Last Post: 2011-12-02, 12:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved