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. ListView delegate isnt able to access model properties after inserting into QAbstractItemModel

ListView delegate isnt able to access model properties after inserting into QAbstractItemModel

Scheduled Pinned Locked Moved Solved General and Desktop
23 Posts 5 Posters 3.0k Views 2 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.
  • C Creaperdown

    @Christian-Ehrlicher thanks for the recommendation, I'll be looking into that but I'm still not sure what causes me actual issue

    Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #12

    @Creaperdown There I can't help - don't use QML

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    C 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      @Creaperdown There I can't help - don't use QML

      C Offline
      C Offline
      Creaperdown
      wrote on last edited by
      #13

      @Christian-Ehrlicher So you think this is a qml related problem?

      Christian EhrlicherC JonBJ 2 Replies Last reply
      0
      • C Creaperdown

        @Christian-Ehrlicher So you think this is a qml related problem?

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #14

        I would create a single/atomar add function to really make sure the add is correct but the rest looks good.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        0
        • C Creaperdown

          @Christian-Ehrlicher So you think this is a qml related problem?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #15

          @Creaperdown
          Yes indeed it is, which is why I suggested this thread might be better moved to QML forum in the first place, though never mind now.

          C 1 Reply Last reply
          0
          • JonBJ JonB

            @Creaperdown
            Yes indeed it is, which is why I suggested this thread might be better moved to QML forum in the first place, though never mind now.

            C Offline
            C Offline
            Creaperdown
            wrote on last edited by
            #16

            @JonB I'll be closing this here then and moving it to the Qml section

            Christian EhrlicherC JoeCFDJ 2 Replies Last reply
            0
            • C Creaperdown deleted this topic on
            • C Creaperdown

              @JonB I'll be closing this here then and moving it to the Qml section

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #17

              Why do you delete this thread? To start over the same discussion about the possible wrong usage of begin/endInsertRows again?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher restored this topic on
              • C Creaperdown

                @JonB I'll be closing this here then and moving it to the Qml section

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #18

                @Creaperdown in your model, do the following:

                    beginResetModel();
                     add new row()
                    endResetModel();
                
                SGaistS 1 Reply Last reply
                0
                • JoeCFDJ JoeCFD

                  @Creaperdown in your model, do the following:

                      beginResetModel();
                       add new row()
                      endResetModel();
                  
                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #19

                  @JoeCFD said in ListView delegate isnt able to access model properties after inserting into QAbstractItemModel:

                  @Creaperdown in your model, do the following:

                      beginResetModel();
                       add new row()
                      endResetModel();
                  

                  If you need to reset the whole model because you insert one row, there's likely a design issue.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  JoeCFDJ 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    @JoeCFD said in ListView delegate isnt able to access model properties after inserting into QAbstractItemModel:

                    @Creaperdown in your model, do the following:

                        beginResetModel();
                         add new row()
                        endResetModel();
                    

                    If you need to reset the whole model because you insert one row, there's likely a design issue.

                    JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by
                    #20

                    @SGaist It is an option. I am not sure if everything is redone.

                    SGaistS 1 Reply Last reply
                    0
                    • JoeCFDJ JoeCFD

                      @SGaist It is an option. I am not sure if everything is redone.

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #21

                      @JoeCFD basically, it tells the view that everything has changed so it should reload everything as a consequence.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      JoeCFDJ 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        @JoeCFD basically, it tells the view that everything has changed so it should reload everything as a consequence.

                        JoeCFDJ Offline
                        JoeCFDJ Offline
                        JoeCFD
                        wrote on last edited by JoeCFD
                        #22

                        @SGaist True. kind of global update. It is better to use
                        beginInsertRows() and endInsertRows().

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          Creaperdown
                          wrote on last edited by
                          #23

                          The problem was a missing reference on the container. It should have been QList<Bookmark>&, thus it didnt update the container when I add a book.

                          1 Reply Last reply
                          0
                          • C Creaperdown has marked this topic as solved on

                          • Login

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