From 4a6d048a77d0954c350df5ce9b3657fc69c9ada4 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Mon, 27 Apr 2026 22:25:02 +0200 Subject: Search/Selectors: Prevent unexpectedly removing a chip One can close a chip by pressing the "X" close button on it. Prior to this commit, one could also close a chip somewhat unexpectedly by choosing an option from the Chip's dropdown. This commit removes any "empty" options from the Chips which would lead to the Chip disappearing. Example: Choosing "Any Rating" would remove the rating chip because it would no longer act as a restriction on what the search should find. Now the "Any Rating" option is not added to the Chip in the first place. --- src/search/selectors/minimumratingselector.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/search/selectors/minimumratingselector.cpp') diff --git a/src/search/selectors/minimumratingselector.cpp b/src/search/selectors/minimumratingselector.cpp index 386f525db..b41561f6a 100644 --- a/src/search/selectors/minimumratingselector.cpp +++ b/src/search/selectors/minimumratingselector.cpp @@ -7,6 +7,7 @@ #include "minimumratingselector.h" +#include "../chip.h" #include "../dolphinquery.h" #include @@ -17,7 +18,9 @@ MinimumRatingSelector::MinimumRatingSelector(std::shared_ptr : QComboBox{parent} , UpdatableStateInterface{dolphinQuery} { - addItem(/** No icon for the empty state */ i18nc("@item:inlistbox", "Any Rating"), 0); + if (!qobject_cast(parent)) { // When in a Chip, we don't add the "Any Rating" option because it would unexpectedly remove the Chip. + addItem(/* No icon for the empty state */ i18nc("@item:inlistbox", "Any Rating"), 0); + } addItem(QIcon::fromTheme(QStringLiteral("starred-symbolic")), i18nc("@item:inlistbox", "1 or more"), 2); addItem(QIcon::fromTheme(QStringLiteral("starred-symbolic")), i18nc("@item:inlistbox", "2 or more"), 4); addItem(QIcon::fromTheme(QStringLiteral("starred-symbolic")), i18nc("@item:inlistbox", "3 or more"), 6); -- cgit v1.3