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 to import components from main folder to subfolder?
Forum Updated to NodeBB v4.3 + New Features

How to import components from main folder to subfolder?

Scheduled Pinned Locked Moved QML and Qt Quick
qmlqqmlapplication
4 Posts 2 Posters 4.5k Views 2 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.
  • V Offline
    V Offline
    vishnu
    wrote on 25 Jun 2015, 08:47 last edited by vishnu
    #1

    I have a qml file (DirectRegister.qml )in the same directory as main.qml and main.cpp but under QML folder in Qt creator. This folder is added when i added new qt quick file.When i use this( DirectRegister.qml) component in another files it is detecting but when i run the program it says .
    QQmlApplicationEngine failed to load component
    DirectRegister.qml is not a type.
    What's wrong am I doing? But this works fine when i add them to the resources.Is that the way to do?

    Problem: When i put qml files in different folders i import like this
    import "../subfolder".
    To import elements from main folder to subfolder i do like this
    import "./". Complied but again the same problem
    QQmlApplicationEngine failed to load component
    DirectRegister.qml is not a type.
    How to import components from main folder to subfolder?

    P 1 Reply Last reply 25 Jun 2015, 10:05
    0
    • V vishnu
      25 Jun 2015, 08:47

      I have a qml file (DirectRegister.qml )in the same directory as main.qml and main.cpp but under QML folder in Qt creator. This folder is added when i added new qt quick file.When i use this( DirectRegister.qml) component in another files it is detecting but when i run the program it says .
      QQmlApplicationEngine failed to load component
      DirectRegister.qml is not a type.
      What's wrong am I doing? But this works fine when i add them to the resources.Is that the way to do?

      Problem: When i put qml files in different folders i import like this
      import "../subfolder".
      To import elements from main folder to subfolder i do like this
      import "./". Complied but again the same problem
      QQmlApplicationEngine failed to load component
      DirectRegister.qml is not a type.
      How to import components from main folder to subfolder?

      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 25 Jun 2015, 10:05 last edited by
      #2

      @vishnu
      Try with a Qualifier as said here.
      Personally I always use Qt's resource system. In this way it is more easy to deploy.

      157

      V 1 Reply Last reply 25 Jun 2015, 12:33
      1
      • P p3c0
        25 Jun 2015, 10:05

        @vishnu
        Try with a Qualifier as said here.
        Personally I always use Qt's resource system. In this way it is more easy to deploy.

        V Offline
        V Offline
        vishnu
        wrote on 25 Jun 2015, 12:33 last edited by
        #3

        @p3c0
        In order to organise files. I put in different folders. So now I want to import one file from sub folder to main folder and main folder to subfolder. In short can you please describe me?
        From subfolder to main folder : i do it like this
        import "../subfolder"

        But on reverse i am confused what to do.
        I read the document you described above but still I didn't get. I am sorry.

        P 1 Reply Last reply 26 Jun 2015, 06:44
        0
        • V vishnu
          25 Jun 2015, 12:33

          @p3c0
          In order to organise files. I put in different folders. So now I want to import one file from sub folder to main folder and main folder to subfolder. In short can you please describe me?
          From subfolder to main folder : i do it like this
          import "../subfolder"

          But on reverse i am confused what to do.
          I read the document you described above but still I didn't get. I am sorry.

          P Offline
          P Offline
          p3c0
          Moderators
          wrote on 26 Jun 2015, 06:44 last edited by
          #4

          @vishnu

          From subfolder to main folder : i do it like this
          import "../subfolder"
          But on reverse i am confused what to do.

          How about import "../" ?

          157

          1 Reply Last reply
          0

          4/4

          26 Jun 2015, 06:44

          • Login

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