diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-06-06 19:23:15 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-06-18 12:35:36 +0000 |
commit | 5f9f8f9f167d7f21d4b2b7c9c2b143a8e86a9d8c (patch) | |
tree | 6652253c5f6ae8e3613ff65b2fa5e30ac72a1dfc /src/libs/tracing/flamegraph.cpp | |
parent | b16ba2ba59b2877d6b6827f2d3717fd40c6a6627 (diff) |
Tracing: Handle mouse events in FlameGraph QQuickItem
Having an additional MouseArea as child of a ScrollView or a Flickable
is not well defined and leads to inconsistent behavior on different
systems. We can easily catch the relevant events in the FlameGraph item
itself. Also, don't redirect the typeSelected() signals through the
model. They don't belong there.
Change-Id: I77c17977b5a51d57ccd2ef880d3d6c6a604b7f78
Task-number: QTCREATORBUG-20573
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs/tracing/flamegraph.cpp')
-rw-r--r-- | src/libs/tracing/flamegraph.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/libs/tracing/flamegraph.cpp b/src/libs/tracing/flamegraph.cpp index 2fa38313ed..9d7df037f5 100644 --- a/src/libs/tracing/flamegraph.cpp +++ b/src/libs/tracing/flamegraph.cpp @@ -30,6 +30,8 @@ namespace FlameGraph { FlameGraph::FlameGraph(QQuickItem *parent) : QQuickItem(parent) { + setAcceptedMouseButtons(Qt::LeftButton); + // Queue the rebuild in this case so that a delegate can set the root without getting deleted // during the call. connect(this, &FlameGraph::rootChanged, this, &FlameGraph::rebuild, Qt::QueuedConnection); @@ -130,7 +132,6 @@ QObject *FlameGraph::appendChild(QObject *parentObject, QQuickItem *parentItem, return childObject; } - int FlameGraph::buildNode(const QModelIndex &parentIndex, QObject *parentObject, int depth, int maximumDepth) { @@ -194,4 +195,22 @@ void FlameGraph::rebuild() emit depthChanged(m_depth); } +void FlameGraph::mousePressEvent(QMouseEvent *event) +{ + Q_UNUSED(event); +} + +void FlameGraph::mouseReleaseEvent(QMouseEvent *event) +{ + Q_UNUSED(event); + setSelectedTypeId(-1); +} + +void FlameGraph::mouseDoubleClickEvent(QMouseEvent *event) +{ + Q_UNUSED(event); + setSelectedTypeId(-1); + resetRoot(); +} + } // namespace FlameGraph |