diff --git a/src/UserInterface/ListView/klistview.cpp b/src/UserInterface/ListView/klistview.cpp index 91fbe08..28c83c2 100755 --- a/src/UserInterface/ListView/klistview.cpp +++ b/src/UserInterface/ListView/klistview.cpp @@ -92,8 +92,9 @@ void KListView::mouseMoveEvent(QMouseEvent *e) void KListView::mousePressEvent(QMouseEvent *event) { - if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) { - m_pressApp = m_listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole); + m_pressPos = event->pos(); + if ((this->indexAt(m_pressPos).isValid()) && event->button() == Qt::LeftButton) { + m_pressApp = m_listmodel->data(this->indexAt(m_pressPos), Qt::DisplayRole); } return QListView::mousePressEvent(event); } diff --git a/src/UserInterface/ListView/klistview.h b/src/UserInterface/ListView/klistview.h index 503997b..2ac6f3d 100755 --- a/src/UserInterface/ListView/klistview.h +++ b/src/UserInterface/ListView/klistview.h @@ -36,6 +36,7 @@ public: int module = 0; double m_transparency; QVariant m_pressApp; + QPoint m_pressPos; UkuiMenuInterface *m_ukuiMenuInterface = nullptr; protected: void paintEvent(QPaintEvent *e); diff --git a/src/UserInterface/ListView/listview.cpp b/src/UserInterface/ListView/listview.cpp index 3ec9cd7..a9a9ed2 100755 --- a/src/UserInterface/ListView/listview.cpp +++ b/src/UserInterface/ListView/listview.cpp @@ -50,7 +50,6 @@ ListView::~ListView() void ListView::initWidget() { setAttribute(Qt::WA_TranslucentBackground); - this->setAcceptDrops(true); viewport()->setAttribute(Qt::WA_TranslucentBackground); viewport()->setAutoFillBackground(false); this->setSelectionMode(QAbstractItemView::SingleSelection); diff --git a/src/UserInterface/ListView/listview.h b/src/UserInterface/ListView/listview.h index 6a26210..cfcfbf8 100755 --- a/src/UserInterface/ListView/listview.h +++ b/src/UserInterface/ListView/listview.h @@ -57,8 +57,6 @@ private: int h = 0; int m_preRowCount; bool m_scrollbarState = true; - QPoint m_pressPos; - private Q_SLOTS: void onClicked(QModelIndex index);//点击item