Use Pressed/Released eventpoint state with native gesture begin/end
The QSinglePointEvent is mostly responsible for setting QEventPoint::state(); but in this case we need to decide based on Qt::NativeGestureType, so it needs to be refined in the QNativeGestureEvent constructor. Fixes: QTBUG-94178 Change-Id: I9799fe5b8fea71f934311ae2f3bb8e033d132ec5 Reviewed-by: Povilas Kanapickas <povilas@radix.lt> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
169a248fdf
commit
0336f08fec
@ -2829,6 +2829,19 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin
|
|||||||
m_sequenceId(sequenceId), m_deltas(deltas), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
|
m_sequenceId(sequenceId), m_deltas(deltas), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
|
||||||
{
|
{
|
||||||
Q_ASSERT(fingerCount < 16); // we store it in 4 bits unsigned
|
Q_ASSERT(fingerCount < 16); // we store it in 4 bits unsigned
|
||||||
|
|
||||||
|
// make correction to QEventPoint::state(): the QSinglePointEvent ctor doesn't get gesture type, defaults to Updated
|
||||||
|
auto &pt = QMutableEventPoint::from(m_points.first());
|
||||||
|
switch (type) {
|
||||||
|
case Qt::BeginNativeGesture:
|
||||||
|
pt.setState(QEventPoint::State::Pressed);
|
||||||
|
break;
|
||||||
|
case Qt::EndNativeGesture:
|
||||||
|
pt.setState(QEventPoint::State::Released);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QNativeGestureEvent::~QNativeGestureEvent() = default;
|
QNativeGestureEvent::~QNativeGestureEvent() = default;
|
||||||
|
Loading…
Reference in New Issue
Block a user