Fix registering touch screen edge actions after the screen edge has been reserved
After the screen edge is reserved, the touch screen gestures will be registered or unregistered when the Edge::activatesForTouchGesture() signal is emitted. On the other hand, Edge::reserveTouch() lacks code to emit that signal, which results in touch screen gesture not working if the same screen edge is reserved both for pointer and touch input. BUG: 451349
This commit is contained in:
parent
35a7e30952
commit
6be238e622
1 changed files with 13 additions and 3 deletions
|
@ -188,10 +188,14 @@ void Edge::reserveTouchCallBack(const TouchCallback &callback)
|
||||||
})) {
|
})) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const bool wasTouch = activatesForTouchGesture();
|
||||||
connect(callback.touchUpAction(), &QAction::destroyed, this, [this, callback]() {
|
connect(callback.touchUpAction(), &QAction::destroyed, this, [this, callback]() {
|
||||||
unreserveTouchCallBack(callback.touchUpAction());
|
unreserveTouchCallBack(callback.touchUpAction());
|
||||||
});
|
});
|
||||||
m_touchCallbacks << callback;
|
m_touchCallbacks << callback;
|
||||||
|
if (wasTouch != activatesForTouchGesture()) {
|
||||||
|
Q_EMIT activatesForTouchGestureChanged();
|
||||||
|
}
|
||||||
reserve();
|
reserve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,10 +204,16 @@ void Edge::unreserveTouchCallBack(QAction *action)
|
||||||
auto it = std::find_if(m_touchCallbacks.begin(), m_touchCallbacks.end(), [action](const TouchCallback &c) {
|
auto it = std::find_if(m_touchCallbacks.begin(), m_touchCallbacks.end(), [action](const TouchCallback &c) {
|
||||||
return c.touchUpAction() == action;
|
return c.touchUpAction() == action;
|
||||||
});
|
});
|
||||||
if (it != m_touchCallbacks.end()) {
|
if (it == m_touchCallbacks.end()) {
|
||||||
m_touchCallbacks.erase(it);
|
return;
|
||||||
unreserve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool wasTouch = activatesForTouchGesture();
|
||||||
|
m_touchCallbacks.erase(it);
|
||||||
|
if (wasTouch != activatesForTouchGesture()) {
|
||||||
|
Q_EMIT activatesForTouchGestureChanged();
|
||||||
|
}
|
||||||
|
unreserve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Edge::unreserve()
|
void Edge::unreserve()
|
||||||
|
|
Loading…
Reference in a new issue