Commit 2ccd4ea2 authored by Julius Künzel's avatar Julius Künzel
Browse files

Effect and transition list: make it possible to search by id

parent 3827e0d0
Pipeline #51749 passed with stage
in 10 minutes and 44 seconds
...@@ -59,11 +59,13 @@ bool AssetFilter::filterName(const std::shared_ptr<TreeItem> &item) const ...@@ -59,11 +59,13 @@ bool AssetFilter::filterName(const std::shared_ptr<TreeItem> &item) const
if (!m_name_enabled) { if (!m_name_enabled) {
return true; return true;
} }
QString itemId = item->dataColumn(AssetTreeModel::idCol).toString().toUtf8().constData();
itemId = itemId.normalized(QString::NormalizationForm_D).remove(QRegExp(QStringLiteral("[^a-zA-Z0-9\\s]")));
QString itemText = i18n(item->dataColumn(AssetTreeModel::nameCol).toString().toUtf8().constData()); QString itemText = i18n(item->dataColumn(AssetTreeModel::nameCol).toString().toUtf8().constData());
itemText = itemText.normalized(QString::NormalizationForm_D).remove(QRegExp(QStringLiteral("[^a-zA-Z0-9\\s]"))); itemText = itemText.normalized(QString::NormalizationForm_D).remove(QRegExp(QStringLiteral("[^a-zA-Z0-9\\s]")));
QString patt = m_name_value.normalized(QString::NormalizationForm_D).remove(QRegExp(QStringLiteral("[^a-zA-Z0-9\\s]"))); QString patt = m_name_value.normalized(QString::NormalizationForm_D).remove(QRegExp(QStringLiteral("[^a-zA-Z0-9\\s]")));
return itemText.contains(patt, Qt::CaseInsensitive); return itemText.contains(patt, Qt::CaseInsensitive) || itemId.contains(patt, Qt::CaseInsensitive);
} }
bool AssetFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const bool AssetFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment