From 514a62b9b26fcdc19d8bdad5d2db22306304c055 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 12 Jan 2023 16:12:40 +0100 Subject: [PATCH] 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 --- src/plugins/qtsupport/exampleslistmodel.cpp | 23 --------------------- src/plugins/qtsupport/exampleslistmodel.h | 2 -- 2 files changed, 25 deletions(-) diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 849b506eaf0..21261b384e3 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -637,29 +637,6 @@ QStringList ExampleSetModel::exampleSources(QString *examplesInstallPath, QStrin 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(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) { if (index != m_selectedExampleSetIndex) { diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h index a4f7636e4a2..7360e825922 100644 --- a/src/plugins/qtsupport/exampleslistmodel.h +++ b/src/plugins/qtsupport/exampleslistmodel.h @@ -106,8 +106,6 @@ class ExamplesListModel : public Core::ListModel public: explicit ExamplesListModel(QObject *parent); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const final; - void updateExamples(); QStringList exampleSets() const;