QmlProfiler: linking JS events with QML events

Change-Id: Id2f37caef0c62fa8fa830fed8f46dcbb0a565cdb
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2011-12-14 14:30:37 +01:00
parent 5798225cc8
commit eef3d91ea1
3 changed files with 22 additions and 0 deletions

View File

@@ -181,6 +181,11 @@ void QmlProfilerEventsWidget::updateSelectedEvent(int eventId) const
m_eventTree->selectEvent(eventId);
}
void QmlProfilerEventsWidget::selectBySourceLocation(const QString &filename, int line)
{
m_eventTree->selectEventByLocation(filename, line);
}
bool QmlProfilerEventsWidget::hasGlobalStats() const
{
return m_globalStatsEnabled;
@@ -589,6 +594,18 @@ void QmlProfilerEventsMainView::selectEvent(int eventId)
}
}
void QmlProfilerEventsMainView::selectEventByLocation(const QString &filename, int line)
{
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) {
setCurrentIndex(d->m_model->indexFromItem(infoItem));
jumpToItem(currentIndex());
return;
}
}
}
QModelIndex QmlProfilerEventsMainView::selectedItem() const
{
QModelIndexList sel = selectedIndexes();

View File

@@ -79,6 +79,7 @@ signals:
public slots:
void updateSelectedEvent(int eventId) const;
void selectBySourceLocation(const QString &filename, int line);
protected:
void contextMenuEvent(QContextMenuEvent *ev);
@@ -149,6 +150,7 @@ public slots:
void clear();
void jumpToItem(const QModelIndex &index);
void selectEvent(int eventId);
void selectEventByLocation(const QString &filename, int line);
void buildModel();
private:

View File

@@ -388,6 +388,9 @@ QWidget *QmlProfilerTool::createWidgets()
connect(d->m_v8profilerView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int)));
connect(d->m_v8profilerView, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
connect(d->m_v8profilerView, SIGNAL(gotoSourceLocation(QString,int)), d->m_eventsView, SLOT(selectBySourceLocation(QString,int)));
connect(d->m_eventsView, SIGNAL(gotoSourceLocation(QString,int)), d->m_v8profilerView, SLOT(selectBySourceLocation(QString,int)));
QDockWidget *eventsDock = AnalyzerManager::createDockWidget
(this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea);
QDockWidget *timelineDock = AnalyzerManager::createDockWidget