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?

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
  • 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.
  • vishnuV Offline
    vishnuV Offline
    vishnu
    wrote on 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?

    p3c0P 1 Reply Last reply
    0
    • vishnuV vishnu

      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?

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on 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

      vishnuV 1 Reply Last reply
      1
      • p3c0P p3c0

        @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.

        vishnuV Offline
        vishnuV Offline
        vishnu
        wrote on 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.

        p3c0P 1 Reply Last reply
        0
        • vishnuV vishnu

          @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.

          p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on 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

          • Login

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