Welcome: Replace search term when adding tags

Currently, both are mixed into one so neither of them works. When both
are separated with a space, the search term is ignored anyway so it's
better to just remove it.

Change-Id: I449b5d80dc50620f13f37c908e63877eb63b3c26
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Robert Löhning
2022-02-28 21:34:13 +01:00
parent 50199cab93
commit 0fa5303916
2 changed files with 6 additions and 4 deletions

View File

@@ -132,8 +132,9 @@ public:
void onTagClicked(const QString &tag)
{
QString text = m_searcher->text();
m_searcher->setText(text + QString("tag:\"%1\" ").arg(tag));
const QString text = m_searcher->text();
m_searcher->setText((text.startsWith("tag:\"") ? text.trimmed() + " " : QString())
+ QString("tag:\"%1\" ").arg(tag));
}
private:

View File

@@ -326,8 +326,9 @@ public:
void onTagClicked(const QString &tag)
{
QString text = m_searcher->text();
m_searcher->setText(text + QString("tag:\"%1\" ").arg(tag));
const QString text = m_searcher->text();
m_searcher->setText((text.startsWith("tag:\"") ? text.trimmed() + " " : QString())
+ QString("tag:\"%1\" ").arg(tag));
}
const bool m_isExamples;