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. I can't add a qmldir file to my QML project
Forum Updated to NodeBB v4.3 + New Features

I can't add a qmldir file to my QML project

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 6.4k 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.
  • M Offline
    M Offline
    maxoreli
    wrote on last edited by
    #1

    i want to store locations of plugins and others resources that i use in my projet.Project set up of
    2 folders:core and images that contains especially (Button.qml,FileDialog.qml,TextArea.qml,TextEditor.qml/EditMenu.qml/MenuBar.qml) and an image (arrow.png),i have also a folder nammed plugins which contains my plugin i want to import .

    this is qmlproject file:
    @
    import QmlProject 1.1

    Project {
    mainFile: "testQML1.qml"

    /* Include .qml, .js, and image files from current directory and subdirectories */
    QmlFiles {
        directory: "."
    }
    JavaScriptFiles {
        directory: "."
    }
    ImageFiles {
        directory: "."
    }
    
    /* List of plugin directories passed to QML runtime */
    
    importPaths: [ "./plugins" ]
    

    @

    this is qmldir file:

    @
    Button ./Button.qml
    FileDialog ./FileDialog.qml
    TextArea ./TextArea.qml
    TextEditor ./TextEditor.qml
    EditMenu ./EditMenu.qml

     plugin FileDialog plugins
    

    @

    Now,when i tried to do Add New File > General >create (.txt), i am getting error "Failure to add one or more files to project".

    So,when i run program,the application output displays:
    @
    file:///C:/Users/MAXORELI/Documents/QtPrograms/QtQuickTraining/testQML1/TextEditor.qml:20:5: Type MenuBar unavailable
    MenuBar{
    ^
    file:///C:/Users/MAXORELI/Documents/QtPrograms/QtQuickTraining/testQML1/core/MenuBar.qml:81:9: Type FileMenu unavailable
    FileMenu{
    ^
    file:///C:/Users/MAXORELI/Documents/QtPrograms/QtQuickTraining/testQML1/core/FileMenu.qml:55:5: Directory is not a type
    Directory{
    @

    i would resolve it,thanks for advance

    1 Reply Last reply
    0
    • F Offline
      F Offline
      favoritas37
      wrote on last edited by
      #2

      In the FileMenu.qml, it cant find the definition of the Directory. The other 2 say that they are unavailable because they depend on a child that doesn't exist.

      So you only problem is that it can't find Directory. From what i see you haven't mentioned anywhere a Directory component so it is logical.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        favoritas37
        wrote on last edited by
        #3

        Also i forgot to mention that you could remove the plugin path from qmlproject file and add an import statement in any file you plan to use a component from the plugin. For example if you plan to use the plugin in the core/FileMenu.qml then you could write:
        @
        import "../plugin"
        @

        That would make anything in plugin folder available to your qml file.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          maxoreli
          wrote on last edited by
          #4

          Directory is a class contained in my plugin.
          [quote author="favoritas37" date="1324029741"]In the FileMenu.qml, it cant find the definition of the Directory. The other 2 say that they are unavailable because they depend on a child that doesn't exist.

          So you only problem is that it can't find Directory. From what i see you haven't mentioned anywhere a Directory component so it is logical.[/quote]

          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