×

Discussion Board

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

    how import other qml files?

    Hi all,

    How to import other qml files in Qt Quick?

    I have created a directory naming core.In this directory,I have a file naming waterpage.qml.I have edited qmldir file,its contents are "WaterPage WaterPage.qml"
    In the mainpage.qml,i have coded the following codes:
    import "core"

    Page{

    WaterPage{id:waterpage}

    }

    But when I run the project, Igot the following error:

    Cannot assign to non-existent property "waterpage"
    waterpage{id:waterpage}

    Why this problem happened?

    Thanks for advice.
    Last edited by jahlink; 2012-05-05 at 08:57.

  2. #2
    Nokia Developer Champion
    Join Date
    Aug 2008
    Location
    Vadodara, India.
    Posts
    903

    Re: how import other qml files?

    you can add those other qml files in a folder and than import the folder in main file. Like

    you have one main.qml file and one other files RssModel.qml file. so first put your rss.qml file in a folder lets name it "common".

    than on main.qml file write as below.

    import "common" as Common
    and access RssModel.qml file in main.qml file after above line like below

    Common.RssModel { id: rssModel }
    hope you get the point.
    Nokia Developer Wiki Moderation team
    World's Greatest Speeches for Windows Phone is now available on WP Marketplace.

  3. #3
    Nokia Developer Champion
    Join Date
    Aug 2008
    Location
    Vadodara, India.
    Posts
    903

    Re: how import other qml files?

    for demo code example , you can open any code example of qt quick like "flicker" in Qt Studio and check out the code. There you can see how they have use different qml file in main or other qml file.
    Nokia Developer Wiki Moderation team
    World's Greatest Speeches for Windows Phone is now available on WP Marketplace.

Similar Threads

  1. how to import other qml files?
    By jahlink in forum [Archived] Beginning Qt
    Replies: 3
    Last Post: 2012-05-10, 00:08
  2. how to import files in the emulator?
    By foshanzhuifeng in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2010-11-02, 07:53
  3. cannot import mmp files
    By khalid.usman7@gmail.com in forum Symbian Tools & SDKs
    Replies: 9
    Last Post: 2010-08-29, 20:24
  4. Import files to existing app
    By Scolpy in forum Python
    Replies: 3
    Last Post: 2008-11-08, 23:14
  5. how to import jar files to eclipse sdk??.....plz help!!
    By muskan in forum General Messaging
    Replies: 0
    Last Post: 2007-07-20, 19:08

Posting Permissions

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