Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
Would it be feasible to provide a means to search the `data` portion of QListWidgetItems held in a QListWidget? Currently, I note there is a method to search the text part only:
QList<QListWidgetItem*> QListWidget::findItems(const QString&text, Qt::MatchFlags flags) const
Finds items with the text that matches the string text using the given flags.
I would like to draw a comparison with the QComboBox widget which instead returns an index rather than a list of item pointers but can do so for both the text entry specifically but also for any data role as well:
int QComboBox::findData(const QVariant&data, int role = Qt::UserRole, Qt::MatchFlags flags = static_cast<Qt::MatchFlags>(Qt::MatchExactly|Qt::MatchCaseSensitive)) const
Returns the index of the item containing the given data for the given role; otherwise returns -1.
The flags specify how the items in the combobox are searched.
int QComboBox::findText(const QString&text, Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const
Returns the index of the item containing the given text; otherwise returns -1.
The flags specify how the items in the combobox are searched.