forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Kai Koehne
parent
4a87c3aedd
commit
b33a654b8b
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user