forked from qt-creator/qt-creator
QmlProfiler: linking JS events with QML events
Change-Id: Id2f37caef0c62fa8fa830fed8f46dcbb0a565cdb Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -181,6 +181,11 @@ void QmlProfilerEventsWidget::updateSelectedEvent(int eventId) const
|
|||||||
m_eventTree->selectEvent(eventId);
|
m_eventTree->selectEvent(eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerEventsWidget::selectBySourceLocation(const QString &filename, int line)
|
||||||
|
{
|
||||||
|
m_eventTree->selectEventByLocation(filename, line);
|
||||||
|
}
|
||||||
|
|
||||||
bool QmlProfilerEventsWidget::hasGlobalStats() const
|
bool QmlProfilerEventsWidget::hasGlobalStats() const
|
||||||
{
|
{
|
||||||
return m_globalStatsEnabled;
|
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
|
QModelIndex QmlProfilerEventsMainView::selectedItem() const
|
||||||
{
|
{
|
||||||
QModelIndexList sel = selectedIndexes();
|
QModelIndexList sel = selectedIndexes();
|
||||||
|
@@ -79,6 +79,7 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateSelectedEvent(int eventId) const;
|
void updateSelectedEvent(int eventId) const;
|
||||||
|
void selectBySourceLocation(const QString &filename, int line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
@@ -149,6 +150,7 @@ public slots:
|
|||||||
void clear();
|
void clear();
|
||||||
void jumpToItem(const QModelIndex &index);
|
void jumpToItem(const QModelIndex &index);
|
||||||
void selectEvent(int eventId);
|
void selectEvent(int eventId);
|
||||||
|
void selectEventByLocation(const QString &filename, int line);
|
||||||
void buildModel();
|
void buildModel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -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(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int)));
|
||||||
connect(d->m_v8profilerView, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
|
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
|
QDockWidget *eventsDock = AnalyzerManager::createDockWidget
|
||||||
(this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea);
|
(this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea);
|
||||||
QDockWidget *timelineDock = AnalyzerManager::createDockWidget
|
QDockWidget *timelineDock = AnalyzerManager::createDockWidget
|
||||||
|
Reference in New Issue
Block a user