Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.10.0
-
None
Description
When I attach a QCompleter, I can use its completionModel as input to, e.g., a QListView. This is great for using a QLineEdit + QCompleter combination as a filter input to allow the user to search/filter items in the list.
The problem arises when I need to interact with items in the list. Let's have a look at the signature:
QAbstractItemModel *QCompleter::completionModel() const
This signature hides the fact that QCompleter uses a (subclass of) QAbstractProxyModel. This renders signals that provide me with a ModelIndex pretty much useless, as I cannot call QAbstractProxyModel::mapToSource().
I suggest to change the signature such as:
QAbstractProxyModel *QCompleter::completionModel() const
My current workaround is ugly:
auto proxy = qobject_cast<const QAbstractProxyModel*>(completer->completionModel());