From dc2e8472e349b7c80c9b4bec40324a640fff3cff Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 13 Feb 2019 13:52:18 +0100 Subject: [PATCH] Utils: Forward BaseTreeView mouse move events to model Similar to what press and release do already. Change-Id: I787d266c8c8cd430114b2448adfb2379a5795a47 Reviewed-by: Christian Stenger --- src/libs/utils/basetreeview.cpp | 8 ++++++++ src/libs/utils/basetreeview.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp index 03139a41540..7b39e766893 100644 --- a/src/libs/utils/basetreeview.cpp +++ b/src/libs/utils/basetreeview.cpp @@ -427,6 +427,14 @@ void BaseTreeView::mousePressEvent(QMouseEvent *ev) // d->toggleColumnWidth(columnAt(ev->x())); } +void BaseTreeView::mouseMoveEvent(QMouseEvent *ev) +{ + ItemViewEvent ive(ev, this); + QTC_ASSERT(model(), return); + if (!model()->setData(ive.index(), QVariant::fromValue(ive), ItemViewEventRole)) + TreeView::mouseMoveEvent(ev); +} + void BaseTreeView::mouseReleaseEvent(QMouseEvent *ev) { ItemViewEvent ive(ev, this); diff --git a/src/libs/utils/basetreeview.h b/src/libs/utils/basetreeview.h index 36da6589133..fdf6f619379 100644 --- a/src/libs/utils/basetreeview.h +++ b/src/libs/utils/basetreeview.h @@ -60,6 +60,7 @@ public: void setModel(QAbstractItemModel *model) override; void mousePressEvent(QMouseEvent *ev) override; + void mouseMoveEvent(QMouseEvent *ev) override; void mouseReleaseEvent(QMouseEvent *ev) override; void contextMenuEvent(QContextMenuEvent *ev) override; void showEvent(QShowEvent *ev) override;