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 can I get the application QmlEngine ?
Forum Updated to NodeBB v4.3 + New Features

How can I get the application QmlEngine ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
38 Posts 4 Posters 9.5k 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.
  • KroMignonK KroMignon

    @kmarconi said in How can I get the application QmlEngine ?:

    I have the error "ListElement: cannot use script for property value"

    AFAIK, ListElement cannot be changed dynamically ==> cf QTBUG-16289

    edit

    You have to use QT_TR_NOOP() and qsTr() on the delegate, like this (extract from QTBUG-16289):

    ListModel {
        id: myModel
    
        ListElement {
            desc: QT_TR_NOOP("Example")
        }
    }
    
    ListView {
        model: myModel
    
        delegate: Text {
            text: qsTr(desc)
        }
    }
    
    K Offline
    K Offline
    kmarconi
    wrote on last edited by kmarconi
    #25

    @KroMignon Yeah just seen it on a stackoverflow post (https://stackoverflow.com/questions/7659442/listelement-fields-as-properties) but I canno't change my qml part because the way it is designed is fixed so I need to find a way to use the retranslate function without having this binding loop.

    KroMignonK 1 Reply Last reply
    0
    • K kmarconi

      @KroMignon Yeah just seen it on a stackoverflow post (https://stackoverflow.com/questions/7659442/listelement-fields-as-properties) but I canno't change my qml part because the way it is designed is fixed so I need to find a way to use the retranslate function without having this binding loop.

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by KroMignon
      #26

      @kmarconi said in How can I get the application QmlEngine ?:

      I need to find a way to use the retranslate function without having this binding loop.

      Take a look at the QTBUG-16289, the way they propose is to use QT_TR_NOOP() on ListElement to add string in translation file, and to use qsTr() in the delegate to do translation.

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      K 1 Reply Last reply
      2
      • KroMignonK KroMignon

        @kmarconi said in How can I get the application QmlEngine ?:

        I need to find a way to use the retranslate function without having this binding loop.

        Take a look at the QTBUG-16289, the way they propose is to use QT_TR_NOOP() on ListElement to add string in translation file, and to use qsTr() in the delegate to do translation.

        K Offline
        K Offline
        kmarconi
        wrote on last edited by
        #27

        @KroMignon Damn it is so hard to debug a binding loop with QT. Will keep you updated if I finally found out what's going on with my program.

        KroMignonK 1 Reply Last reply
        0
        • K kmarconi

          @KroMignon Damn it is so hard to debug a binding loop with QT. Will keep you updated if I finally found out what's going on with my program.

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by
          #28

          @kmarconi said in How can I get the application QmlEngine ?:

          Damn it is so hard to debug a binding loop with QT.

          Yes, binding loops are the hell!
          Which Qt Version are you using? For Qt 5.10 and upper you can enable tracing to help you to find bindings problems with QT_LOGGING_RULES.
          For example in your main.cpp:

              qputenv("QT_LOGGING_RULES", "qt.qml.binding.removal.info=true");
          

          Take look at this https://www.kdab.com/new-qt-5-10-diagnostics-breaking-qml-bindings/ for more details.

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          K 2 Replies Last reply
          1
          • KroMignonK KroMignon

            @kmarconi said in How can I get the application QmlEngine ?:

            Damn it is so hard to debug a binding loop with QT.

            Yes, binding loops are the hell!
            Which Qt Version are you using? For Qt 5.10 and upper you can enable tracing to help you to find bindings problems with QT_LOGGING_RULES.
            For example in your main.cpp:

                qputenv("QT_LOGGING_RULES", "qt.qml.binding.removal.info=true");
            

            Take look at this https://www.kdab.com/new-qt-5-10-diagnostics-breaking-qml-bindings/ for more details.

            K Offline
            K Offline
            kmarconi
            wrote on last edited by
            #29

            @KroMignon I'm on QT 5.12.3 so that could save me. Will tell you, thanks !

            1 Reply Last reply
            0
            • KroMignonK KroMignon

              @kmarconi said in How can I get the application QmlEngine ?:

              Damn it is so hard to debug a binding loop with QT.

              Yes, binding loops are the hell!
              Which Qt Version are you using? For Qt 5.10 and upper you can enable tracing to help you to find bindings problems with QT_LOGGING_RULES.
              For example in your main.cpp:

                  qputenv("QT_LOGGING_RULES", "qt.qml.binding.removal.info=true");
              

              Take look at this https://www.kdab.com/new-qt-5-10-diagnostics-breaking-qml-bindings/ for more details.

              K Offline
              K Offline
              kmarconi
              wrote on last edited by
              #30

              @KroMignon My binding loop error hasn't changed at all even with "qputenv("QT_LOGGING_RULES", "qt.qml.binding.removal.info=true");" in my main.cpp file .. Am I condemned to live in this infinite binding loop ? haha

              KroMignonK 1 Reply Last reply
              0
              • K kmarconi

                @KroMignon My binding loop error hasn't changed at all even with "qputenv("QT_LOGGING_RULES", "qt.qml.binding.removal.info=true");" in my main.cpp file .. Am I condemned to live in this infinite binding loop ? haha

                KroMignonK Offline
                KroMignonK Offline
                KroMignon
                wrote on last edited by
                #31

                @kmarconi said in How can I get the application QmlEngine ?:

                Am I condemned to live in this infinite binding loop ?

                Can you show the QML code which is not working well?

                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                1 Reply Last reply
                0
                • K kmarconi

                  Here is my main.qml file :

                  Item {
                  id:root
                  visible: true
                  width: 640
                  height: 480

                  property var mainMenu: Menu{rootStack: root}
                  
                  StackView {
                      anchors.fill: parent
                      id: menuStack
                  
                      property var button: hmiclass.button
                      initialItem: mainMenu
                  
                      onButtonChanged: {
                          mainMenu.onButtonPushed(button)
                      }
                  }
                  

                  }

                  EDIT: I need to find where that loop is coming from.. Or to find a patch to refresh only the bindings which are in the translation file.

                  K Offline
                  K Offline
                  kmarconi
                  wrote on last edited by
                  #32

                  @kmarconi said in How can I get the application QmlEngine ?:

                  Here is my main.qml file :

                  Item {
                  id:root
                  visible: true
                  width: 640
                  height: 480

                  property var mainMenu: Menu{rootStack: root}
                  
                  StackView {
                      anchors.fill: parent
                      id: menuStack
                  
                      property var button: hmiclass.button
                      initialItem: mainMenu
                  
                      onButtonChanged: {
                          mainMenu.onButtonPushed(button)
                      }
                  }
                  

                  }

                  EDIT: I need to find where that loop is coming from.. Or to find a patch to refresh only the bindings which are in the translation file.

                  This is the one

                  KroMignonK 1 Reply Last reply
                  0
                  • K kmarconi

                    @kmarconi said in How can I get the application QmlEngine ?:

                    Here is my main.qml file :

                    Item {
                    id:root
                    visible: true
                    width: 640
                    height: 480

                    property var mainMenu: Menu{rootStack: root}
                    
                    StackView {
                        anchors.fill: parent
                        id: menuStack
                    
                        property var button: hmiclass.button
                        initialItem: mainMenu
                    
                        onButtonChanged: {
                            mainMenu.onButtonPushed(button)
                        }
                    }
                    

                    }

                    EDIT: I need to find where that loop is coming from.. Or to find a patch to refresh only the bindings which are in the translation file.

                    This is the one

                    KroMignonK Offline
                    KroMignonK Offline
                    KroMignon
                    wrote on last edited by
                    #33

                    @kmarconi And what is the binding loop error message? I can't see any obvious error on this code extract.

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    K 1 Reply Last reply
                    0
                    • KroMignonK KroMignon

                      @kmarconi And what is the binding loop error message? I can't see any obvious error on this code extract.

                      K Offline
                      K Offline
                      kmarconi
                      wrote on last edited by
                      #34

                      @KroMignon Sorry, the error is : QML StackView: Binding loop detected for property "button"

                      KroMignonK 1 Reply Last reply
                      0
                      • K kmarconi

                        @KroMignon Sorry, the error is : QML StackView: Binding loop detected for property "button"

                        KroMignonK Offline
                        KroMignonK Offline
                        KroMignon
                        wrote on last edited by
                        #35

                        @kmarconi said in How can I get the application QmlEngine ?:

                        the error is : QML StackView: Binding loop detected for property "button"

                        According to your code, it looks like mainMenu.onButtunPushed() will change hmiclass.button content, which will recall mainMenu.onButtunPushed()...

                        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                        K 1 Reply Last reply
                        0
                        • KroMignonK KroMignon

                          @kmarconi said in How can I get the application QmlEngine ?:

                          the error is : QML StackView: Binding loop detected for property "button"

                          According to your code, it looks like mainMenu.onButtunPushed() will change hmiclass.button content, which will recall mainMenu.onButtunPushed()...

                          K Offline
                          K Offline
                          kmarconi
                          wrote on last edited by
                          #36

                          @KroMignon Yeah that's what I tought but why this error is only showing on retranslate and not on the app boot too ?

                          KroMignonK 1 Reply Last reply
                          0
                          • K kmarconi

                            @KroMignon Yeah that's what I tought but why this error is only showing on retranslate and not on the app boot too ?

                            KroMignonK Offline
                            KroMignonK Offline
                            KroMignon
                            wrote on last edited by
                            #37

                            @kmarconi said in How can I get the application QmlEngine ?:

                            Yeah that's what I tought but why this error is only showing on retranslate and not on the app boot too ?

                            Because there have to be a first change to start the loop!
                            I don't know what is changing hmiclass.button?

                            I suppose hmiclass is a C++ class instance and button is a property of this class.
                            In some way the attached signal to this property is emitted, which will start the loop.

                            That is just an hypothesis, I don't have a clue about your code.

                            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                            K 1 Reply Last reply
                            0
                            • KroMignonK KroMignon

                              @kmarconi said in How can I get the application QmlEngine ?:

                              Yeah that's what I tought but why this error is only showing on retranslate and not on the app boot too ?

                              Because there have to be a first change to start the loop!
                              I don't know what is changing hmiclass.button?

                              I suppose hmiclass is a C++ class instance and button is a property of this class.
                              In some way the attached signal to this property is emitted, which will start the loop.

                              That is just an hypothesis, I don't have a clue about your code.

                              K Offline
                              K Offline
                              kmarconi
                              wrote on last edited by
                              #38

                              @KroMignon Yeah sorry I know that I'm asking a lot of help without any clue of my code. But I canno't share more information about it, I'm sorry... Will try to solve my problem with what you gave me today and will keep you updated. Thanks a lot

                              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