mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 05:20:00 -08:00
Add reusable compact multi-select Essence popup filter
This commit is contained in:
parent
2ab6bccb48
commit
4e21602fce
1 changed files with 38 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef CONTINUUMATRICE_ESSENCE_FILTER_PICKER_H
|
||||
#define CONTINUUMATRICE_ESSENCE_FILTER_PICKER_H
|
||||
|
||||
#include <QChar>
|
||||
#include <QHash>
|
||||
#include <QSet>
|
||||
#include <QToolButton>
|
||||
|
||||
class QMenu;
|
||||
|
||||
/**
|
||||
* Compact, reusable multi-select Essence picker for the deck and card database
|
||||
* toolbars. The menu contains all fifteen Essence symbols in a 5x3 icon grid.
|
||||
* Clicking a symbol does not close the popup; programmatic synchronization
|
||||
* does not emit a user-selection signal.
|
||||
*/
|
||||
class EssenceFilterPicker final : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EssenceFilterPicker(QWidget *parent = nullptr);
|
||||
|
||||
[[nodiscard]] QSet<QChar> activeEssences() const;
|
||||
void setEssenceActive(QChar essence, bool active);
|
||||
void retranslateUi();
|
||||
|
||||
signals:
|
||||
void essenceToggled(QChar essence, bool active);
|
||||
|
||||
private:
|
||||
void updateSummary();
|
||||
|
||||
QHash<QChar, QToolButton *> buttons;
|
||||
QMenu *popupMenu = nullptr;
|
||||
};
|
||||
|
||||
#endif // CONTINUUMATRICE_ESSENCE_FILTER_PICKER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue