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. Updating a proxy model

Updating a proxy model

Scheduled Pinned Locked Moved Unsolved General and Desktop
model-view
8 Posts 2 Posters 3.1k 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.
  • KlimichKartorGnusovK Offline
    KlimichKartorGnusovK Offline
    KlimichKartorGnusov
    wrote on last edited by KlimichKartorGnusov
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If the source model has been implemented correctly, it should be done automatically.

      What is your use case ?

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

      KlimichKartorGnusovK 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        If the source model has been implemented correctly, it should be done automatically.

        What is your use case ?

        KlimichKartorGnusovK Offline
        KlimichKartorGnusovK Offline
        KlimichKartorGnusov
        wrote on last edited by
        #3

        @SGaist For update the source model i use a signal:

        QAbstractItemModel::dataChange(const QModelIndex & topLeft, const QModelIndex & bottomRight)
        

        Necessary something else?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What modification are you doing ? Through setData ?

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

          KlimichKartorGnusovK 1 Reply Last reply
          0
          • SGaistS SGaist

            What modification are you doing ? Through setData ?

            KlimichKartorGnusovK Offline
            KlimichKartorGnusovK Offline
            KlimichKartorGnusov
            wrote on last edited by KlimichKartorGnusov
            #5

            @SGaist I use a custom method instead setData(). The changes are simple. Swap 1 to 0. After all is done, i emit a signal dataChange. Row which contains 1, should be in the proxy model, but is not happens. I must call the invalidate method that would update the proxy model. Why dataChange signal in source model is not enough?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Without seeing your code it's pretty much Crystal Ball Debugging. Can you share the implementation of that method ?

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

              KlimichKartorGnusovK 1 Reply Last reply
              0
              • SGaistS SGaist

                Without seeing your code it's pretty much Crystal Ball Debugging. Can you share the implementation of that method ?

                KlimichKartorGnusovK Offline
                KlimichKartorGnusovK Offline
                KlimichKartorGnusov
                wrote on last edited by KlimichKartorGnusov
                #7

                @SGaist Source code isn't contains mistakes. I change an object from the source data from the outside by an editor widget and for update model, i emit a signal dataChanged.
                As I understand it, after this proxy model must call protected method filterAcceptsRow for a changed row but it isn't happens. For update i must call a invalidate method, that is not good, because will be processed all row from the source model. Maybe i something don't understand?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Like I said, without seeing any code I can't comment on whether the wrong index is being used or something else is going on.

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

                  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