Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2012

    [moved] How application knows which is the 1st QML page to load?

    Can please someone explain what is the main idea behind MainPage{} element in QML code for MeeGo device and how all this pages stuff works? I read all docs 100s of times and still cannot grasp the idea.

    When creating blank application for MeeGo two files are created: main.qml and MainPage.qml.
    I can understand that main application window is described in main.qml by PageStackWindow{} element and it has some elements descriptions common for all pages, for example ToolBarLayout{}.

    1) But what is the need of MainPage.qml file? It describes Page{} element, but I cannot understand how and when this page is loaded. How application knows that this page "mainPage" (for Symbian) or "page1" (for Harmattan) is the first page to load? And why "initialPage:" property of PageStackWindow{} points to MainPage{} which describes nothing and not to "mainPage" or "page1" which describes actual page?

    2) And why in MainPage.qml file Page{} element "page1" in "tools:" property can see "commonTools" object which is described in main.qml file, but there is no backwards access from elements in main.qml file to "page1" element?

    These two questions make me stuck in understanding of Qt Quick workflow...

  2. #2
    Registered User
    Join Date
    Sep 2011

    Re: [moved] How application knows which is the 1st QML page to load?


    1. For any qml file when it is written saying say
    Rectangle {
    TextEdit {


    When you run it, you can see that a TextEdit element is shown on screen (TextEdit is a default QML element). When you need custom elements you would define it in a qml file like the one in MainPage.qml and use the name of the file to create/use such element in the main.qml

    This is similar to writing your own Button.qml (inside the file it would be a Rectangle with desired properties, this is like declaring and defining a class) and when you use it in your UI, you would use it as Button { }. At this point the actual instance is created and painted to UI.

    initialPage is a property of the PageStackWindow element that allows you to define the first page to be loaded, hence you give the id of MainPage element there.

    2. Since as i said the actual instance is created and embedded when you write MainPage {} in the main.qml file, you would be able to use the commonTools in the main.qml in this object (something like a friend) , but the viceversa is not possible.

    I have tried to explain, but someone feels that they can word it or explain or contradict, please feel free..
    Last edited by kusumk; 2012-05-11 at 04:43.

  3. #3
    Registered User
    Join Date
    Apr 2012

    Re: [moved] How application knows which is the 1st QML page to load?

    Thank you very much for your detailed explanation !!!

Similar Threads

  1. load html page
    By idrish_it in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2010-03-04, 06:58
  2. Invalid application when i try load JAR filefrom a wml-page on the Internet
    By crajesh_2985 in forum Mobile Service Architecture (Closed)
    Replies: 0
    Last Post: 2009-09-19, 10:29
  3. How to load up a new form page
    By marc_garraway in forum Mobile Java General
    Replies: 2
    Last Post: 2008-10-16, 17:26

Posting Permissions

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