Results 1 to 4 of 4

Thread: QML Library question

  1. #1
    Join Date
    Jun 2012
    Posts
    18
    Thanked 9 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QML Library question

    I’m looking to put all my QML component files (button, checkbox ect) in a centralized location. I copied them to QT_PATH/imports/components/ folder as well as a qmldir file and was able to import as follows

    import components 0.1

    I can use the components in a Qt Quick project no problem, but I noticed in design view they do not show up. Is there another file that is needed to make them show up in the designer library item pane, so I can drag and drop?

    Thanks

  2. #2
    Join Date
    Nov 2010
    Posts
    82
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QML Library question

    import components 0.1 is valid if your components are put into some plugin
    you can just simply do :

    import "<relative_path_to_qml_files>"
    ex: import "../../myComponent"
    in <myComponent> you put all your qml files
    this relative path will also be used if you put them into a ressource file but it will be a path inside the ressource not the hard drive

  3. #3
    Join Date
    Jun 2012
    Posts
    18
    Thanked 9 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QML Library question

    I don't want to use a relative path. Really no reason for me to create a plugin when all I'm doing is creating about 20 qml components that use javascript, but maybe I have to create some kind of plugin that does nothing inorder for them to show up in the designer.

    Here is a link I found that kind of explains what I want to do:

    http://www.qtcentre.org/archive/index.php/t-43911.html?

    Install QML-Component:
    1.) Copy your "custom" folder into QT_PATH/imports/Qt/labs
    2.) Import your component in your main.qml

    import Qt.labs.custom 1.0
    3.) Write an QML-Designer Plugin with a *.metainfo-File, where you populate your Component.

    I guess the question is how do I implement #3?

  4. #4
    Join Date
    Nov 2010
    Posts
    82
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QML Library question

    maybe i explained it wrong
    what i meant was:
    1 - do not put import components 0.1
    2 - do not put a qmldir
    3 - just put import "<path to you qml files>"

    it will show your files in the editor and it will be usable at run time

Similar Threads

  1. Dynamic library on Mac, Library not loaded
    By grayfox in forum Newbie
    Replies: 2
    Last Post: 2nd July 2011, 02:42
  2. Replies: 2
    Last Post: 19th February 2011, 11:26
  3. Replies: 4
    Last Post: 18th December 2009, 18:55
  4. Replies: 2
    Last Post: 22nd February 2007, 08:08
  5. static library archiving question
    By ChasW in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2007, 08:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.