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. Random "Invalid grouped property access" error

Random "Invalid grouped property access" error

Scheduled Pinned Locked Moved Solved QML and Qt Quick
12 Posts 3 Posters 3.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.
  • GPBetaG Offline
    GPBetaG Offline
    GPBeta
    wrote on last edited by GPBeta
    #3

    @devDawg Thank you for your reply :)
    Please checkout the completed minimal project to reproduce this issue:

    https://drive.google.com/file/d/1XCjSXlXu4SfulP_hwRVwkoDjejdComHV/view?usp=sharing

    There's no other property access will raise this error, except for this revision tagged and grouped icon property which is defined in QQuickAbstractButton.
    The Component.onCompleted() solution is not very suitable for my requirement because it will override bindings created before component completed.

    \BAKA BAKA/

    DiracsbracketD 1 Reply Last reply
    0
    • GPBetaG GPBeta

      @devDawg Thank you for your reply :)
      Please checkout the completed minimal project to reproduce this issue:

      https://drive.google.com/file/d/1XCjSXlXu4SfulP_hwRVwkoDjejdComHV/view?usp=sharing

      There's no other property access will raise this error, except for this revision tagged and grouped icon property which is defined in QQuickAbstractButton.
      The Component.onCompleted() solution is not very suitable for my requirement because it will override bindings created before component completed.

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by Diracsbracket
      #4

      Hi @GPBeta
      I tried your example, it works without problems on my system (Win10, VS2017, Qt 5.11.0).
      The "randomness" of the problem seems not reproducible here?

              My.Button {
                  text: "My Button"
                  onClicked: {
                      console.debug("T.Button: " + icon.height + ", " + icon.width)
                  }
              }
      

      gives:

      qml: T.Button: 18, 18
      qml: T.Button: 18, 18
      qml: T.Button: 18, 18
      ...
      qml: T.Button: 18, 18
      qml: T.Button: 18, 18
      qml: T.Button: 18, 18
      

      No warnings nor errors are produced.

      1 Reply Last reply
      0
      • GPBetaG Offline
        GPBetaG Offline
        GPBeta
        wrote on last edited by GPBeta
        #5

        Hi @Diracsbracket
        The error occurs randomly only on startup, so please try to start it as much as possible, or just remove

        Button { text: "Qt Button" }
        

        and the program will never start here.

        \BAKA BAKA/

        DiracsbracketD 1 Reply Last reply
        0
        • GPBetaG GPBeta

          Hi @Diracsbracket
          The error occurs randomly only on startup, so please try to start it as much as possible, or just remove

          Button { text: "Qt Button" }
          

          and the program will never start here.

          DiracsbracketD Offline
          DiracsbracketD Offline
          Diracsbracket
          wrote on last edited by
          #6

          @GPBeta
          What is MyModule.Templates? You import it in imports\MyModule\Button.qml but it's defined nowhere.

          GPBetaG 1 Reply Last reply
          0
          • DiracsbracketD Diracsbracket

            @GPBeta
            What is MyModule.Templates? You import it in imports\MyModule\Button.qml but it's defined nowhere.

            GPBetaG Offline
            GPBetaG Offline
            GPBeta
            wrote on last edited by
            #7

            @Diracsbracket
            MyModule.Templates is registered via qmlRegisterModule("MyModule.Templates", 1, 0);
            T.Button is registered via qmlRegisterType<MyButtonTemplate>("MyModule.Templates", 1, 0, "Button");
            They're both C++ codes in main.cpp

            \BAKA BAKA/

            DiracsbracketD 2 Replies Last reply
            0
            • GPBetaG GPBeta

              @Diracsbracket
              MyModule.Templates is registered via qmlRegisterModule("MyModule.Templates", 1, 0);
              T.Button is registered via qmlRegisterType<MyButtonTemplate>("MyModule.Templates", 1, 0, "Button");
              They're both C++ codes in main.cpp

              DiracsbracketD Offline
              DiracsbracketD Offline
              Diracsbracket
              wrote on last edited by Diracsbracket
              #8

              @GPBeta
              My bad... should have read your post more carefully...
              I have never defined or even used templates before, so I will just watch and learn from this thread...

              1 Reply Last reply
              0
              • GPBetaG GPBeta

                @Diracsbracket
                MyModule.Templates is registered via qmlRegisterModule("MyModule.Templates", 1, 0);
                T.Button is registered via qmlRegisterType<MyButtonTemplate>("MyModule.Templates", 1, 0, "Button");
                They're both C++ codes in main.cpp

                DiracsbracketD Offline
                DiracsbracketD Offline
                Diracsbracket
                wrote on last edited by Diracsbracket
                #9

                @GPBeta
                By adding:

                import QtQuick.Templates 2.2
                

                to your Button.qml template file, it seems to work?

                import QtQuick 2.11
                import QtQuick.Templates 2.2
                import MyModule.Templates 1.0 as T
                

                Apparently, without it, the required QQuickIcon type from

                qtquickcontrols2/src/quicktemplates2/qquickicon_p.h
                

                does not get registered, hence the errors you get?

                1 Reply Last reply
                2
                • GPBetaG Offline
                  GPBetaG Offline
                  GPBeta
                  wrote on last edited by
                  #10

                  @Diracsbracket Great! It works perfectly now!

                  The QQuickIcon is registered in the QtQuick.Templates qml plug-in(qtquicktemplates2plugin.dll), while my C++ module only linked against Qt5QuickTemplates2.dll.

                  So if we don't import that module explicitly, the icon property may be randomly registered later than the binding access.

                  I also tried to add depends QtQuick.Templates 2.4 in the qmldir but with no luck.

                  Whatever, I believe this is the best solution for me, thank you so much :)

                  \BAKA BAKA/

                  DiracsbracketD 1 Reply Last reply
                  1
                  • GPBetaG GPBeta

                    @Diracsbracket Great! It works perfectly now!

                    The QQuickIcon is registered in the QtQuick.Templates qml plug-in(qtquicktemplates2plugin.dll), while my C++ module only linked against Qt5QuickTemplates2.dll.

                    So if we don't import that module explicitly, the icon property may be randomly registered later than the binding access.

                    I also tried to add depends QtQuick.Templates 2.4 in the qmldir but with no luck.

                    Whatever, I believe this is the best solution for me, thank you so much :)

                    DiracsbracketD Offline
                    DiracsbracketD Offline
                    Diracsbracket
                    wrote on last edited by Diracsbracket
                    #11

                    @GPBeta
                    Thank you for the explanation. Now the randomness makes sense.
                    Btw. I just checked your webpage. It's quite awesome!

                    GPBetaG 1 Reply Last reply
                    0
                    • DiracsbracketD Diracsbracket

                      @GPBeta
                      Thank you for the explanation. Now the randomness makes sense.
                      Btw. I just checked your webpage. It's quite awesome!

                      GPBetaG Offline
                      GPBetaG Offline
                      GPBeta
                      wrote on last edited by
                      #12

                      @Diracsbracket lol, thank you :P

                      \BAKA BAKA/

                      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