mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-31 05:35:36 -05:00
Prevent accidental edits of actions and conditions when scrolling
This commit is contained in:
@@ -649,3 +649,30 @@ void MacroRefAction::ResolveMacroRef()
|
||||
{
|
||||
_macro.UpdateRef();
|
||||
}
|
||||
|
||||
MouseWheelWidgetAdjustmentGuard::MouseWheelWidgetAdjustmentGuard(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool MouseWheelWidgetAdjustmentGuard::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
const QWidget *widget = static_cast<QWidget *>(o);
|
||||
if (e->type() == QEvent::Wheel && widget && !widget->hasFocus()) {
|
||||
e->ignore();
|
||||
return true;
|
||||
}
|
||||
|
||||
return QObject::eventFilter(o, e);
|
||||
}
|
||||
|
||||
MacroSegmentEdit::MacroSegmentEdit(QWidget *parent) : QWidget(parent) {}
|
||||
|
||||
void MacroSegmentEdit::SetFocusPolicyOfWidgets()
|
||||
{
|
||||
QList<QWidget *> widgets = this->findChildren<QWidget *>();
|
||||
for (auto w : widgets) {
|
||||
w->setFocusPolicy(Qt::StrongFocus);
|
||||
w->installEventFilter(new MouseWheelWidgetAdjustmentGuard(w));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user