┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search/selectors/minimumratingselector.cpp
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2026-04-27 22:25:02 +0200
committerFelix Ernst <[email protected]>2026-04-29 01:51:03 +0200
commit4a6d048a77d0954c350df5ce9b3657fc69c9ada4 (patch)
tree4c5fddcba01eb06134e3346501e8d9092bed6aee /src/search/selectors/minimumratingselector.cpp
parentaf12f10b7d0fdbc5b737abb226f27077e6f952a7 (diff)
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.
Diffstat (limited to 'src/search/selectors/minimumratingselector.cpp')
-rw-r--r--src/search/selectors/minimumratingselector.cpp5
1 files changed, 4 insertions, 1 deletions
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 <KLocalizedString>
@@ -17,7 +18,9 @@ MinimumRatingSelector::MinimumRatingSelector(std::shared_ptr<const DolphinQuery>
: QComboBox{parent}
, UpdatableStateInterface{dolphinQuery}
{
- addItem(/** No icon for the empty state */ i18nc("@item:inlistbox", "Any Rating"), 0);
+ if (!qobject_cast<ChipBase *>(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);