Prevent accidental edits of actions and conditions when scrolling

This commit is contained in:
WarmUpTill
2021-07-18 14:16:04 +02:00
committed by WarmUpTill
parent 95409dfa26
commit 84e4b740a8
6 changed files with 55 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ private:
static std::map<std::string, MacroActionInfo> _methods;
};
class MacroActionEdit : public QWidget {
class MacroActionEdit : public MacroSegmentEdit {
Q_OBJECT
public:

View File

@@ -35,7 +35,7 @@ private:
static std::map<std::string, MacroConditionInfo> _methods;
};
class MacroConditionEdit : public QWidget {
class MacroConditionEdit : public MacroSegmentEdit {
Q_OBJECT
public:

View File

@@ -159,3 +159,23 @@ public:
void ResolveMacroRef();
MacroRef _macro;
};
// TODO: Rework macro condition and action edit to allow moving control
// handling to MacroSegmentEdit
class MacroSegmentEdit : public QWidget {
Q_OBJECT
public:
MacroSegmentEdit(QWidget *parent = nullptr);
// Use this function to avoid accidental edits when scrolling through
// list of actions and conditions
void SetFocusPolicyOfWidgets();
};
class MouseWheelWidgetAdjustmentGuard : public QObject {
public:
explicit MouseWheelWidgetAdjustmentGuard(QObject *parent);
protected:
bool eventFilter(QObject *o, QEvent *e) override;
};