Fix Tools menu items not disabling alongside tool buttons
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled

This commit is contained in:
GriffinR
2026-03-26 19:55:31 -04:00
parent b9dd7637a6
commit 79aa78c8ae
8 changed files with 58 additions and 43 deletions

View File

@@ -17,15 +17,22 @@ public slots:
};
/// Emits a signal when a window gets activated / regains focus
class ActiveWindowFilter : public QObject {
/// Emits a signal when the given event or events occur
class EventSignaler : public QObject {
Q_OBJECT
public:
ActiveWindowFilter(QObject *parent) : QObject(parent) {}
virtual ~ActiveWindowFilter() {}
EventSignaler(const QSet<QEvent::Type>& types, QObject *parent) : QObject(parent), m_types(types) {}
EventSignaler(QEvent::Type type, QObject *parent) : EventSignaler(QSet<QEvent::Type>{type}, parent) {}
virtual ~EventSignaler() {}
void addEventType(QEvent::Type type) { m_types.insert(type); }
void removeEventType(QEvent::Type type) { m_types.remove(type); }
bool eventFilter(QObject *obj, QEvent *event) override;
signals:
void activated();
void triggered();
private:
QSet<QEvent::Type> m_types;
};