Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How can I use qml items from another project ?

How can I use qml items from another project ?

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aabc
    wrote on last edited by
    #1

    I created my own qml objects and i want to use them in another project using import.
    for example:

    the file c:\myObjectFolder\MyItems\myQmlItem.qml
    @myQmlItem
    {
    ....
    }@

    in another project I want to do this:
    @
    import QtQuick 1.0
    import MyItems 1.0

    myQmlItem
    {
    ...
    }
    @

    is it possible?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kkrzewniak
      wrote on last edited by
      #2

      Yes you can.

      1. Use uppercase starting names for the files.
      2. Use:
        @import "path_to_a_folder_containing_the_files_defining_your_new_objects"@
        The objects get named according their respective file names.

      Me, Grimlock, not "nice dino". ME BASH BRAINS!

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aabc
        wrote on last edited by
        #3

        I dont want to import like this:
        import "path to the file"

        I want to use import like this:
        import MyItems 1.0

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kkrzewniak
          wrote on last edited by
          #4

          Not path to file but path to the folder with custom qml items.
          And if you insist on using Import Sth 1.0, than AFAIK you'll need to write your own C++ extensions for qml.
          "Tutorial: Writing QML extensions with C++":http://doc.qt.nokia.com/4.7/qml-extending-tutorial-index.html
          "QML Modules":http://doc.qt.nokia.com/4.7/qdeclarativemodules.html#qml-modules

          Me, Grimlock, not "nice dino". ME BASH BRAINS!

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            ZapB
            wrote on last edited by
            #5

            I made a pair of example projects showing how to do this "here":http://developer.qt.nokia.com/forums/viewthread/7171/P30/#42472

            Nokia Certified Qt Specialist
            Interested in hearing about Qt related work

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved