From b33a654b8b808201618fff853e0617aa120ebdf5 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen <christiaan.janssen@nokia.com> Date: Mon, 23 Jan 2012 17:40:32 +0100 Subject: [PATCH] QmlProfiler: avoid selection jumping between views The JS profiler doesn't use column information. This can produce undesired side effects when changing the selection from the QML pane if the signal bounces back. Change-Id: I76d8c97c53b0c4800f855054cdb5ff5e8d034d65 Reviewed-by: Kai Koehne <kai.koehne@nokia.com> --- src/plugins/qmlprofiler/qmlprofilereventview.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index bd890c00142..e26d2e5d260 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -217,6 +217,7 @@ public: QList<bool> m_fieldShown; int m_firstNumericColumn; int m_detailsColumn; + bool m_preventSelectBounce; }; @@ -241,6 +242,7 @@ QmlProfilerEventsMainView::QmlProfilerEventsMainView(QmlProfilerEventList *model d->m_firstNumericColumn = 0; d->m_detailsColumn = 0; + d->m_preventSelectBounce = false; // default view setViewType(EventsView); @@ -574,6 +576,10 @@ int QmlProfilerEventsMainView::selectedEventId() const void QmlProfilerEventsMainView::jumpToItem(const QModelIndex &index) { + if (d->m_preventSelectBounce) + return; + + d->m_preventSelectBounce = true; QStandardItem *clickedItem = d->m_model->itemFromIndex(index); QStandardItem *infoItem; if (clickedItem->parent()) @@ -595,6 +601,8 @@ void QmlProfilerEventsMainView::jumpToItem(const QModelIndex &index) if (d->m_viewType == EventsView) { emit showEventInTimeline(infoItem->data(EventIdRole).toInt()); } + + d->m_preventSelectBounce = false; } void QmlProfilerEventsMainView::selectEvent(int eventId) @@ -611,6 +619,9 @@ void QmlProfilerEventsMainView::selectEvent(int eventId) void QmlProfilerEventsMainView::selectEventByLocation(const QString &filename, int line) { + if (d->m_preventSelectBounce) + return; + for (int i=0; i<d->m_model->rowCount(); i++) { QStandardItem *infoItem = d->m_model->item(i, 0); if (currentIndex() != d->m_model->indexFromItem(infoItem) && infoItem->data(FilenameRole).toString() == filename && infoItem->data(LineRole).toInt() == line) { -- GitLab