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

@@ -231,24 +231,18 @@ private slots:
void on_actionBetter_Cursors_triggered();
void on_actionPlayer_View_Rectangle_triggered();
void on_actionCursor_Tile_Outline_triggered();
void on_actionPencil_triggered();
void on_actionPointer_triggered();
void on_actionFlood_Fill_triggered();
void on_actionEyedropper_triggered();
void on_actionMove_triggered();
void on_actionMap_Shift_triggered();
void tryAddEventTab(QWidget * tab);
void displayEventTabs();
void updateSelectedEvents();
void updateEvents();
void on_toolButton_Paint_clicked();
void on_toolButton_Select_clicked();
void on_toolButton_Fill_clicked();
void on_toolButton_Dropper_clicked();
void on_toolButton_Move_clicked();
void on_toolButton_Shift_clicked();
void activatePaintTool();
void activateSelectTool();
void activateFillTool();
void activatePickTool();
void activateMoveTool();
void activateShiftTool();
void onOpenMapListContextMenu(const QPoint &point);
void currentMetatilesSelectionChanged();
@@ -429,6 +423,7 @@ private:
void initLogStatusBar();
void initCustomUI();
void initExtraSignals();
void connectToolButtons();
void initEditor();
void initMiscHeapObjects();
void initMapList();

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;
};