forked from qt-creator/qt-creator
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:
@@ -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) {
|
||||||
|
@@ -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;
|
||||||
|
Reference in New Issue
Block a user