Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion dde-clipboard/listview.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -14,9 +14,10 @@
#include <QDebug>
#include <QTimer>
#include <QPropertyAnimation>
#include <QScroller>

Check warning on line 17 in dde-clipboard/listview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScroller> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDrag>

Check warning on line 18 in dde-clipboard/listview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDrag> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QMimeData>

Check warning on line 19 in dde-clipboard/listview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMimeData> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QGestureEvent>

Check warning on line 20 in dde-clipboard/listview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QGestureEvent> not found. Please note: Cppcheck does not need standard library headers to get proper results.

ListView::ListView(QWidget *parent)
: QListView(parent)
Expand Down Expand Up @@ -227,3 +228,17 @@
}
return QListView::changeEvent(event);
}

bool ListView::event(QEvent *event)
{
if (event->type() == QEvent::Gesture) {
QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(event);
for (QGesture *gesture : gestureEvent->gestures()) {
if (gesture->state() == Qt::GestureFinished || gesture->state() == Qt::GestureCanceled) {
resetReadyDragState();
break;
}
}
}
return QListView::event(event);
}
3 changes: 2 additions & 1 deletion dde-clipboard/listview.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -47,6 +47,7 @@ class ListView : public QListView
virtual void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
virtual void changeEvent(QEvent *event) override;
bool event(QEvent *event) override;

private:
void resetReadyDragState();
Expand Down
Loading