Skip to content
  • 0 Votes
    8 Posts

    @JonB @SGaist @DerReisende Thank you all very much. Thats kinda tedious to do but guess thats how it is. Appreciate all your help and indeed mapFrom and mapToSource are what fixes my issue. :D Y'all have a nice day.

  • 0 Votes
    8 Posts
    Joel BodenmannJ

    @FPEY said in QSortFilterProxyModel: Reset model shows ghost items:

    EDIT: Nevermind, my issue was also a stupid mistake: I was simply not calling the function to make the whole reset model stuff when I had multiple lines selected ^^

    Glad to hear that you managed to resolve your issue :)

    I'm not exactly sure where the problem I was facing originated from hence I didn't leave any details as I don't want people to be mislead.
    This was my first time working with QStandardItemModel. So far I have always implemented models directly by deriving from QAbstractItemModel.

    When using the QStandardItemModel with the proxy model, the proxy's state was not invalidated when rows were inserted or removed (again, I don't know (yet) why).

    The quick fix without actually understanding the problem was to invoke the QStandardItemModel::invalidate slot whenever rows were either inserted or removed:

    connect(m_model, &model::rowsInserted, m_proxy_model, &QSortFilterProxyModel::invalidate); connect(m_model, &model::rowsRemoved, m_proxy_model, &QSortFilterProxyModel::invalidate);


    m_model is of type QStandardItemModel* m_proxy_model is of type QSortFilterProxyModel*
  • 0 Votes
    6 Posts

    IIRC something like: