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. Import QML File from QRC
QtWS25 Last Chance

Import QML File from QRC

Scheduled Pinned Locked Moved QML and Qt Quick
qrcqmlimport
5 Posts 2 Posters 4.3k 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.
  • V Offline
    V Offline
    Vostro162
    wrote on 2 Aug 2015, 20:27 last edited by
    #1

    Hello Guys,
    my main.qml is in qml.qrc// directory.
    my import file is also in this qrc directory.
    i try this paths
    import "qrc:/importFile.qml" as ImportFile
    import "qrc:///importFile.qml" as ImportFile
    import "importFile.qml" as ImportFile
    but is not working

    thanks in the advance for the help

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on 3 Aug 2015, 04:49 last edited by
      #2

      If both qml files have the same prefix (in your case, /), you don't need to import it. Use the filename without extension to instantiate it.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vostro162
        wrote on 3 Aug 2015, 18:23 last edited by
        #3

        yes both files have the prefix / but this path
        import "importFile.qml" as ImportFile
        is not working the error is that
        QML debugging is enabled. Only use this in a safe environment.
        QQmlApplicationEngine failed to load component
        qrc:///main.qml:4 "collectionView.qml": no such directory
        maybe i must change my main.cpp file ?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Leonardo
          wrote on 3 Aug 2015, 18:30 last edited by
          #4

          Once again, you don't need to import it. You should be able to instantiate it without a problem.

          importFile {
               id: test
          }
          
          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vostro162
            wrote on 3 Aug 2015, 20:29 last edited by
            #5

            ahh okay thank you ^^

            1 Reply Last reply
            0

            2/5

            3 Aug 2015, 04:49

            • Login

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