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

QIdentityProxyModel::match inappropriately mixes use of proxy model index and source model data method



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.0
    • Fix Version/s: None
    • Component/s: Core: Item Models
    • Labels:
    • Environment:
      Windows 10
      Qt 5.13.0 MSVC 2017 x64

      Qt Creator 4.9.2
      Based on Qt 5.12.4 (MSVC 2017, 32 bit)
      Built on Jun 26 2019 11:28:42
      From revision 8181363fa9
    • Platform/s:


      QIdentityProxyModel, as described in the documentation, is most often used to manipulate data, either by introducing new roles not previously available through the source model or by changing the values certain roles return.

      QModelIndexList QIdentityProxyModel::match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const

      The existing implementation of QIdentityProxyModel::match does not take this into account. It should be matching the passed value against the data returned by the proxy model; instead it returns the source model's data.

      I would have included a small example that filters and remaps certain roles. You would see that calling the proxy model's match method fails when passed the role appropriate for the proxy model, instead succeeding when passed the role from the source model.
      "Jira could not attach the file as there was a missing token. Please try attaching the file again."
      This Jira issue has existed for over a year now... Going to try to attach via another browser.


        1. main.cpp
          1 kB
        2. MyListModel.cpp
          2 kB
        3. MyListModel.h
          0.8 kB
        4. MyProxyModel.cpp
          0.8 kB
        5. MyProxyModel.h
          0.4 kB
        6. MyStruct.h
          0.2 kB
        7. QIdentityProxyModelMatchBugDemo.pro
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            dfaure_kdab David Faure
            dchamberlain David Chamberlain
            0 Vote for this issue
            1 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes