Skip to content

fix: Fix the touch screen vertical swipe dragging issue#259

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix-351197
Mar 23, 2026
Merged

fix: Fix the touch screen vertical swipe dragging issue#259
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix-351197

Conversation

@pengfeixx
Copy link
Copy Markdown
Contributor

@pengfeixx pengfeixx commented Mar 23, 2026

Fix the touch screen vertical swipe dragging issue

Log: Fix the touch screen vertical swipe dragging issue
pms: BUG-351197

Summary by Sourcery

Handle touch gesture completion in the clipboard list view to resolve incorrect drag state after vertical swipe on touch screens.

Bug Fixes:

  • Reset the list view drag-ready state when touch gestures finish or are canceled to prevent unintended dragging after vertical swipes on touch screens.

Enhancements:

  • Override the generic event handler in the clipboard list view to process gesture events and maintain consistent interaction behavior.

Fix the touch screen vertical swipe dragging issue

Log: Fix the touch screen vertical swipe dragging issue
pms: BUG-351197
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 23, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds gesture handling to the clipboard ListView so that drag-ready state is reset when touch gestures finish or are canceled, fixing vertical swipe drag issues, and updates SPDX copyright years.

Sequence diagram for handling gesture events to reset drag state

sequenceDiagram
    participant QScroller
    participant TouchScreen
    participant QtEventLoop
    participant ListView
    participant QListView

    TouchScreen->>QtEventLoop: QEvent_Gesture
    QtEventLoop->>ListView: event(QEvent_pointer)
    activate ListView
    ListView->>ListView: check event->type() == QEvent_Gesture
    ListView->>ListView: gestureEvent = static_cast_QGestureEvent(event)
    loop for each gesture in gestureEvent->gestures()
        ListView->>ListView: check gesture->state()
        alt GestureFinished_or_GestureCanceled
            ListView->>ListView: resetReadyDragState()
        end
    end
    ListView->>QListView: QListView::event(event)
    deactivate ListView
    QListView-->>QtEventLoop: bool handled
    QtEventLoop-->>TouchScreen: update scrolling/dragging state
Loading

Updated class diagram for ListView gesture handling

classDiagram
    class QListView {
        <<QtWidget>>
        +event(QEvent_pointer) bool
        +mousePressEvent(QMouseEvent_pointer) void
        +mouseMoveEvent(QMouseEvent_pointer) void
        +mouseReleaseEvent(QMouseEvent_pointer) void
        +mouseDoubleClickEvent(QMouseEvent_pointer) void
        +changeEvent(QEvent_pointer) void
    }

    class ListView {
        +ListView(QWidget_pointer parent)
        +event(QEvent_pointer) bool
        +mousePressEvent(QMouseEvent_pointer) void
        +mouseMoveEvent(QMouseEvent_pointer) void
        +mouseReleaseEvent(QMouseEvent_pointer) void
        +mouseDoubleClickEvent(QMouseEvent_pointer) void
        +changeEvent(QEvent_pointer) void
        -resetReadyDragState() void
    }

    class QEvent {
        +type() QEvent_Type
    }

    class QGestureEvent {
        +gestures() QList_QGesture_pointer
    }

    class QGesture {
        +state() Qt_GestureState
    }

    ListView --|> QListView
    ListView ..> QEvent : overrides_event
    ListView ..> QGestureEvent : casts_to
    ListView ..> QGesture : iterates_gestures
    QGestureEvent ..> QGesture : contains
Loading

File-Level Changes

Change Details Files
Reset drag-ready state on completion or cancellation of touch gestures to fix vertical swipe dragging behavior in the clipboard list view.
  • Include QGestureEvent to support gesture event handling.
  • Override the generic event handler to intercept QEvent::Gesture events.
  • Iterate over active gestures and, when a gesture reaches Finished or Canceled state, call resetReadyDragState() to clear any pending drag.
  • Delegate unhandled events to the base QListView::event implementation.
dde-clipboard/listview.cpp
dde-clipboard/listview.h
Update SPDX copyright headers to reflect the extended year range.
  • Adjust SPDX-FileCopyrightText comment to use year range 2022 - 2026.
dde-clipboard/listview.cpp
dde-clipboard/listview.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider restricting the reset logic to specific gesture types (e.g., swipe or pan) instead of all gestures, to avoid unintentionally cancelling drags in response to unrelated gestures like taps or pinch-zooms.
  • You might want to short-circuit the event handling (e.g., return true) once you’ve handled a finished/canceled gesture, if you don’t want the base QListView::event to perform additional gesture-related processing that could interfere with the drag state.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider restricting the reset logic to specific gesture types (e.g., swipe or pan) instead of all gestures, to avoid unintentionally cancelling drags in response to unrelated gestures like taps or pinch-zooms.
- You might want to short-circuit the event handling (e.g., return true) once you’ve handled a finished/canceled gesture, if you don’t want the base QListView::event to perform additional gesture-related processing that could interfere with the drag state.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, pengfeixx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pengfeixx
Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented Mar 23, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot Bot merged commit 0aa0e87 into linuxdeepin:master Mar 23, 2026
18 of 19 checks passed
@pengfeixx pengfeixx deleted the fix-351197 branch March 23, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants