diff options
author | hjk <hjk@qt.io> | 2018-02-05 15:06:31 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2018-02-06 08:47:11 +0000 |
commit | 796da44fee615c845515bdc52cd9c6a6e1a240b4 (patch) | |
tree | 2857daa652ef7966b70cb0a9a15a09cfd06fad14 /src/libs/utils/basetreeview.cpp | |
parent | a2d6dc65ff61652399b94f4da87225a86f0e2f41 (diff) |
BaseTreeView: Also pass background single clicks to models
Now that they are no longer used for column resizing the models
might actually assign some custom functionality.
Change-Id: I04d24641f555de0478c9803b4bfde70779747abf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/libs/utils/basetreeview.cpp')
-rw-r--r-- | src/libs/utils/basetreeview.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp index f477ba04533..59ce9255886 100644 --- a/src/libs/utils/basetreeview.cpp +++ b/src/libs/utils/basetreeview.cpp @@ -308,7 +308,9 @@ void BaseTreeView::setModel(QAbstractItemModel *m) void BaseTreeView::mousePressEvent(QMouseEvent *ev) { - TreeView::mousePressEvent(ev); + ItemViewEvent ive(ev, this); + if (!model()->setData(ive.index(), QVariant::fromValue(ive), ItemViewEventRole)) + TreeView::mousePressEvent(ev); // Resizing columns by clicking on the empty space seems to be controversial. // Let's try without for a while. // const QModelIndex mi = indexAt(ev->pos()); @@ -316,6 +318,13 @@ void BaseTreeView::mousePressEvent(QMouseEvent *ev) // d->toggleColumnWidth(columnAt(ev->x())); } +void BaseTreeView::mouseReleaseEvent(QMouseEvent *ev) +{ + ItemViewEvent ive(ev, this); + if (!model()->setData(ive.index(), QVariant::fromValue(ive), ItemViewEventRole)) + TreeView::mouseReleaseEvent(ev); +} + void BaseTreeView::contextMenuEvent(QContextMenuEvent *ev) { ItemViewEvent ive(ev, this); |