Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. what is the best way to organize my qml files?
Forum Update on Monday, May 27th 2025

what is the best way to organize my qml files?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 961 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.
  • Nio74N Offline
    Nio74N Offline
    Nio74
    wrote on last edited by
    #1

    I added a BarcodeScan directory in my qml directory but it is not recognized. How can I do it in order not to be wrong? I tried to look for a lot of information but all old and conflicting. on the qml resource

    0_1557897564915_Cattura.JPG

    jsulmJ 1 Reply Last reply
    0
    • Nio74N Nio74

      I added a BarcodeScan directory in my qml directory but it is not recognized. How can I do it in order not to be wrong? I tried to look for a lot of information but all old and conflicting. on the qml resource

      0_1557897564915_Cattura.JPG

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Nio74 said in what is the best way to organize my qml files?:

      but it is not recognized

      not recognised where?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Nio74N 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Nio74 said in what is the best way to organize my qml files?:

        but it is not recognized

        not recognised where?

        Nio74N Offline
        Nio74N Offline
        Nio74
        wrote on last edited by
        #3

        @jsulm

        0_1557898899626_Cattura2.JPG

        jsulmJ J.HilkJ 2 Replies Last reply
        0
        • Nio74N Nio74

          @jsulm

          0_1557898899626_Cattura2.JPG

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Nio74 How do you import that file?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Nio74N Nio74

            @jsulm

            0_1557898899626_Cattura2.JPG

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by J.Hilk
            #5

            @Nio74 did you import the folder inside your qml file where you want to use it ?

            import QtQuick 5.12
            import "BarcodeScan"
            
            Item{
            ....
            }
            

            Also QML files HAVE to start with a capital letter. You'll have to change that


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            Nio74N 1 Reply Last reply
            3
            • J.HilkJ J.Hilk

              @Nio74 did you import the folder inside your qml file where you want to use it ?

              import QtQuick 5.12
              import "BarcodeScan"
              
              Item{
              ....
              }
              

              Also QML files HAVE to start with a capital letter. You'll have to change that

              Nio74N Offline
              Nio74N Offline
              Nio74
              wrote on last edited by
              #6

              @J.Hilk said in what is the best way to organize my qml files?:

              Also QML files HAVE to start with a capital letter. You'll have to change that

              Not Work:

              qrc:/main2.qml:98:5: QML StackView: push: qrc:/Magazzino.qml:209 MainBarcode is not a type
              

              I have imported but not work ,according to me there is something wrong with my *.prc

              QT += quick widgets
              CONFIG += c++11 core qzxing_qml qzxing_multimedia
              
              
              include($$PWD/QZXing/QZXing.pri)
              
              # The following define makes your compiler emit warnings if you use
              # any Qt feature that has been marked deprecated (the exact warnings
              # depend on your compiler). Refer to the documentation for the
              # deprecated API to know how to port your code away from it.
              DEFINES += QT_DEPRECATED_WARNINGS
              
              # You can also make your code fail to compile if it uses deprecated APIs.
              # In order to do so, uncomment the following line.
              # You can also select to disable deprecated APIs only up to a certain version of Qt.
              #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
              
              SOURCES += \
                      main.cpp \
                  backend.cpp \
                  clientResearch.cpp
              
              RESOURCES += qml.qrc \
                  images.qrc\
              
              
              
              
              # Additional import path used to resolve QML modules in Qt Creator's code model
              QML_IMPORT_PATH =
              
              # Additional import path used to resolve QML modules just for Qt Quick Designer
              QML_DESIGNER_IMPORT_PATH =
              
              # Default rules for deployment.
              qnx: target.path = /tmp/$${TARGET}/bin
              else: unix:!android: target.path = /opt/$${TARGET}/bin
              !isEmpty(target.path): INSTALLS += target
              
              HEADERS += \
                  backend.h \
                  clientResearch.h\
              
              
              DISTFILES +=
              
              
              
              jsulmJ 1 Reply Last reply
              0
              • Nio74N Nio74

                @J.Hilk said in what is the best way to organize my qml files?:

                Also QML files HAVE to start with a capital letter. You'll have to change that

                Not Work:

                qrc:/main2.qml:98:5: QML StackView: push: qrc:/Magazzino.qml:209 MainBarcode is not a type
                

                I have imported but not work ,according to me there is something wrong with my *.prc

                QT += quick widgets
                CONFIG += c++11 core qzxing_qml qzxing_multimedia
                
                
                include($$PWD/QZXing/QZXing.pri)
                
                # The following define makes your compiler emit warnings if you use
                # any Qt feature that has been marked deprecated (the exact warnings
                # depend on your compiler). Refer to the documentation for the
                # deprecated API to know how to port your code away from it.
                DEFINES += QT_DEPRECATED_WARNINGS
                
                # You can also make your code fail to compile if it uses deprecated APIs.
                # In order to do so, uncomment the following line.
                # You can also select to disable deprecated APIs only up to a certain version of Qt.
                #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                
                SOURCES += \
                        main.cpp \
                    backend.cpp \
                    clientResearch.cpp
                
                RESOURCES += qml.qrc \
                    images.qrc\
                
                
                
                
                # Additional import path used to resolve QML modules in Qt Creator's code model
                QML_IMPORT_PATH =
                
                # Additional import path used to resolve QML modules just for Qt Quick Designer
                QML_DESIGNER_IMPORT_PATH =
                
                # Default rules for deployment.
                qnx: target.path = /tmp/$${TARGET}/bin
                else: unix:!android: target.path = /opt/$${TARGET}/bin
                !isEmpty(target.path): INSTALLS += target
                
                HEADERS += \
                    backend.h \
                    clientResearch.h\
                
                
                DISTFILES +=
                
                
                
                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Nio74 But you added

                import "BarcodeScan"
                

                ?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                3
                • J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  To add to @jsulm

                  after changing your resource file, I would recommend to also rerun qmake, so your compiled resource files are up to date as well.


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  2
                  • Nio74N Offline
                    Nio74N Offline
                    Nio74
                    wrote on last edited by
                    #9

                    thank you all for helping me

                    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