ExamplesListModel: Remove unneeded override of data(...)

It seems to have been a workaround for taking tags into account for the
filtering, but that is done completely different nowadays, and not with
the DisplayRole.

Change-Id: Iff73c1a33de4a40c4919794a8644fdc4af710ba1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2023-01-12 16:12:40 +01:00
parent 2f70875ee3
commit 514a62b9b2
2 changed files with 0 additions and 25 deletions

View File

@@ -637,29 +637,6 @@ QStringList ExampleSetModel::exampleSources(QString *examplesInstallPath, QStrin
return sources; return sources;
} }
QString prefixForItem(const ExampleItem *item)
{
QTC_ASSERT(item, return {});
if (item->isHighlighted)
return QLatin1String("0000 ");
return QString();
}
QVariant ExamplesListModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= m_items.count())
return QVariant();
ExampleItem *item = static_cast<ExampleItem *>(m_items.at(index.row()));
switch (role)
{
case Qt::DisplayRole: // for search only
return QString(prefixForItem(item) + item->name + ' ' + item->tags.join(' '));
default:
return ListModel::data(index, role);
}
}
void ExampleSetModel::selectExampleSet(int index) void ExampleSetModel::selectExampleSet(int index)
{ {
if (index != m_selectedExampleSetIndex) { if (index != m_selectedExampleSetIndex) {

View File

@@ -106,8 +106,6 @@ class ExamplesListModel : public Core::ListModel
public: public:
explicit ExamplesListModel(QObject *parent); explicit ExamplesListModel(QObject *parent);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const final;
void updateExamples(); void updateExamples();
QStringList exampleSets() const; QStringList exampleSets() const;