Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-129838

QAbstractListModel with QML setContextProperty error occurs

    XMLWordPrintable

Details

    • Windows

    Description

      I'm creating RPG game by Qt and QML.

      When I create a command window by QML engine, an error occurs.

       

       

      Error message is like this.

       

       

      The odd thing is  that this code had no problem yesterday. I felt so good and went to bed because I could connect QAbstractListModel with QML. (That is to say, I didn't add any code.)When I boot up QtCreator today again, this error suddenly occurs...  This is the reason I wonder that this is a kind of bug.

      As you can see, the above two functions (setContextProperty) have no error.

      Why does this error occur?

      In the case of other reason, sorry for that.

       

      I'm using QQuickWidget as CommandWindow. And then, I added the widget to a QGraphicsScene.

       

      ---------------------------------Edit-------------------------------------------↓

       

      toDoList.zip

      This file is the code of YouTube Qt Community.

      This code has no problem.

      This code uses qml_registerType and  seems not to make  an instance of QAbstractListModel.

      I transplanted this code into my code, but it doesn't work well.

      For example, the above code uses list property in model.

       

      But in my case, this is unknown property...

      QML code doesn't read model well, my command window became white.

      For that reason, I changed my code to the way of pointer type with setContextProperty.

      At first, I tried to transplant toDoList code into my codes, and then, I changed my code to the present code.

      Yesterday, my app might have worked without problems by these two steps for some reasons.

      Attachments

        1. BugReportQAbstractListModel.zip
          4.58 MB
          Harunori Fujimoto
        2. image-2024-10-10-08-50-49-398.png
          37 kB
          Harunori Fujimoto
        3. image-2024-10-10-08-56-09-718.png
          48 kB
          Harunori Fujimoto
        4. image-2024-10-10-14-57-31-084.png
          8 kB
          Harunori Fujimoto
        5. toDoList.zip
          8 kB
          Harunori Fujimoto
        6. タイトルなし.png
          23 kB
          Harunori Fujimoto
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            nori Harunori Fujimoto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes