mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Add clicked() signal to SwipeArea
Emit clicked() when a press-and-release occurs without any swipe movement. This allows consumers to distinguish taps from swipe gestures on the same surface.
This commit is contained in:
parent
523c3a6728
commit
94e2399425
2 changed files with 5 additions and 0 deletions
|
|
@ -309,6 +309,9 @@ void SwipeArea::handleReleaseEvent(QPointerEvent *event, QPointF point)
|
||||||
// if we are in a swipe
|
// if we are in a swipe
|
||||||
if (m_moving) {
|
if (m_moving) {
|
||||||
Q_EMIT swipeEnded();
|
Q_EMIT swipeEnded();
|
||||||
|
} else if (m_pressed) {
|
||||||
|
// No swipe occurred — this was a click/tap
|
||||||
|
Q_EMIT clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSwipe();
|
resetSwipe();
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ Q_SIGNALS:
|
||||||
void touchpadScrollEnded();
|
void touchpadScrollEnded();
|
||||||
void touchpadScrollMove(qreal totalDeltaX, qreal totalDeltaY, qreal deltaX, qreal deltaY);
|
void touchpadScrollMove(qreal totalDeltaX, qreal totalDeltaY, qreal deltaX, qreal deltaY);
|
||||||
|
|
||||||
|
void clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
|
bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue