mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-19 23:25:09 -05:00
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
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:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user