Skip to content
Snippets Groups Projects
Commit b33a654b authored by Christiaan Janssen's avatar Christiaan Janssen Committed by Kai Koehne
Browse files

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: default avatarKai Koehne <kai.koehne@nokia.com>
parent 4a87c3ae
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment