]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/selectors/tagsselector.h
386cbb92444dc6c380d3e36d97f42f880d1634ef
[dolphin.git] / src / search / selectors / tagsselector.h
1 /*
2 SPDX-FileCopyrightText: 2019 Ismael Asensio <isma.af@mgmail.com>
3 SPDX-FileCopyrightText: 2025 Felix Ernst <felixernst@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #ifndef TAGSSELECTOR_H
9 #define TAGSSELECTOR_H
10
11 #include "../updatablestateinterface.h"
12
13 #include <QToolButton>
14
15 namespace Search
16 {
17
18 class TagsSelector : public QToolButton, public UpdatableStateInterface
19 {
20 Q_OBJECT
21
22 public:
23 explicit TagsSelector(std::shared_ptr<const DolphinQuery> dolphinQuery, QWidget *parent = nullptr);
24
25 /** Causes configurationChanged() to be emitted with a DolphinQuery object that does not contain any restriction settable by this class. */
26 void removeRestriction();
27
28 Q_SIGNALS:
29 /** Is emitted whenever settings have changed and a new search might be necessary. */
30 void configurationChanged(const DolphinQuery &dolphinQuery);
31
32 private:
33 /**
34 * Updates the menu items for the various tags based on @p dolphinQuery and the available tags.
35 * This method should only be called when the menu is QMenu::aboutToShow() or the menu is currently visible already while this selector's state changes.
36 * If the menu is open when this method is called, the menu will automatically be reopened to reflect the updated contents.
37 */
38 void updateMenu(const std::shared_ptr<const DolphinQuery> &dolphinQuery);
39
40 void updateState(const std::shared_ptr<const DolphinQuery> &dolphinQuery) override;
41 };
42
43 }
44
45 #endif // TAGSSELECTOR_H