summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/projectexplorer.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2023-02-09 18:07:41 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2023-02-16 15:19:11 +0000
commit5d19894f5be575d93a2271284dbe74a9dcbf4f41 (patch)
treed649f58cae98d2ab97fe1fb4a87470d16c308acd /src/plugins/projectexplorer/projectexplorer.cpp
parent4b9054c4637a391fab2eb4225e911c514c310add (diff)
downloadqt-creator-5d19894f5be575d93a2271284dbe74a9dcbf4f41.tar.gz
LocatorFilterEntry: Add linkForEditor
Make it of std::optional<Utils::Link> type. Use it for: 1. Removing duplicates 2. Showing link inside editor Before, QVariant internalData was used in above cases. Rationale: 1. Removing duplicates between results from different ILocatorFilter makes only sense if accept() overload for these filter types are the same (i.e. the implementation is repeated). Otherwise, we are loosing some functionality when some result is removed. Taking into account that original intention was to eliminate duplicates for filters where we do BaseFileFilter::openEditorAt() inside accept(), we store linkForEditor in 3 cases (instead of storing internalData): - BaseFileFilter - FileSystemFilter (only existing file case) - OpenDocumentsFilter We don't save a linkForEditor where we stored QString inside internalData in the following cases: - JavaScriptFilter - FileSystemFilter (non existing file case) Before, in above cases, we could have filtered out some results unintentionally. This patch should fix it. Now, we remove duplicates only for enties that have value for linkForEditor. 2. Use directly linkForEditor, if exists, for opening editor. This patch aims to decrease the number of different responsibilities of internalData by 1. Make 3rd arg of LocatorFilterEntry c'tor default. Change-Id: I144c58661d7456bb5991f8077dc103272dfab194 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/projectexplorer.cpp')
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 622b18b31e..91ca150008 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -4362,10 +4362,8 @@ void RunConfigurationLocatorFilter::prepareSearch(const QString &entry)
if (!target)
return;
for (auto rc : target->runConfigurations()) {
- if (rc->displayName().contains(entry, Qt::CaseInsensitive)) {
- Core::LocatorFilterEntry filterEntry(this, rc->displayName(), {});
- m_result.append(filterEntry);
- }
+ if (rc->displayName().contains(entry, Qt::CaseInsensitive))
+ m_result.append(LocatorFilterEntry(this, rc->displayName()));
}
}