Details
-
Bug
-
Resolution: Out of scope
-
P4: Low
-
None
-
4.6.2
-
None
-
All
Description
I have this model 'A' that inherits from QAbstractItemModel and provides a reimplemetation of the 'match' method.
This model is 'wrapped' by a QSortFilterProxyModel.
When a keypress event is received in the ItemView that controls the QSortFilterProxyModel the match method gets called
from within the ItemView's event handler.
This calls the proxymodel's match which - by default - calls
QAbstractProxyModel::match(start, role, value, hits, flags); // qsortfilterproxymodel.h line 1971
Since QAbstractProxyModel does not implement a match, the match that gets called is the match as implemented in the
QAbstractItemModel which does what it does.
However My model 'A''s match should be called.
Solution :
implement QAbstractProxyModel::match(..) and call sourceModel()->match().
If no match is implemented, then the QAbstractItemModel's will be called, otherwise the reimplemented version.
Workaround :
Inherit from QSortProxyModel and implement the above solution there.