QmlProfiler: propagate selections from trace to event view by typeId

This is faster and more accurate than propagating by source location.

Change-Id: I6aed3b1591380b49dd7c56a66bdc35912570e347
Task-number: QTCREATORBUG-12932
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-09-29 16:24:34 +02:00
parent 7dfbb1b199
commit 95a13d57c8
9 changed files with 23 additions and 9 deletions

View File

@@ -45,6 +45,7 @@ Rectangle {
property string fileName: ""
property int lineNumber: -1
property int columnNumber: 0
property int typeId: -1
property bool selectionRangeMode: false
@@ -96,7 +97,6 @@ Rectangle {
root.fileName = file;
root.lineNumber = line;
root.columnNumber = column;
root.updateCursorPosition();
}
}
@@ -374,6 +374,9 @@ Rectangle {
view.selectedItem);
gotoSourceLocation(eventLocation.file, eventLocation.line,
eventLocation.column);
root.typeId = qmlProfilerModelProxy.typeId(view.selectedModel,
view.selectedItem);
root.updateCursorPosition();
lockItemSelection = false;
}
} else {
@@ -385,6 +388,8 @@ Rectangle {
var location = qmlProfilerModelProxy.location(modelIndex, pressedItem);
if (location.hasOwnProperty("file")) // not empty
root.gotoSourceLocation(location.file, location.line, location.column);
root.typeId = qmlProfilerModelProxy.typeId(modelIndex, pressedItem);
root.updateCursorPosition();
}
// hack to pass mouse events to the other mousearea if enabled

View File

@@ -312,7 +312,7 @@ void QmlProfilerEventsWidget::copyRowToClipboard() const
d->m_eventTree->copyRowToClipboard();
}
void QmlProfilerEventsWidget::updateSelectedEvent(int typeIndex) const
void QmlProfilerEventsWidget::selectByTypeId(int typeIndex) const
{
if (d->m_eventTree->selectedTypeId() != typeIndex)
d->m_eventTree->selectType(typeIndex);

View File

@@ -89,7 +89,7 @@ signals:
void resized();
public slots:
void updateSelectedEvent(int typeIndex) const;
void selectByTypeId(int typeIndex) const;
void selectBySourceLocation(const QString &filename, int line, int column);
private slots:

View File

@@ -296,9 +296,12 @@ void QmlProfilerTraceView::selectBySourceLocation(const QString &filename, int l
void QmlProfilerTraceView::updateCursorPosition()
{
QQuickItem *rootObject = d->m_mainView->rootObject();
emit gotoSourceLocation(rootObject->property("fileName").toString(),
rootObject->property("lineNumber").toInt(),
rootObject->property("columnNumber").toInt());
QString file = rootObject->property("fileName").toString();
if (!file.isEmpty())
emit gotoSourceLocation(file, rootObject->property("lineNumber").toInt(),
rootObject->property("columnNumber").toInt());
emit typeSelected(rootObject->property("typeId").toInt());
}
////////////////////////////////////////////////////////

View File

@@ -118,7 +118,7 @@ protected:
signals:
void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columNumber);
void eventSelectedByHash(const QString &hash);
void typeSelected(int typeId);
void resized();
private:

View File

@@ -108,8 +108,7 @@ void QmlProfilerViewManager::createViews()
connect(d->eventsView, SIGNAL(gotoSourceLocation(QString,int,int)), this,
SIGNAL(gotoSourceLocation(QString,int,int)));
connect(d->eventsView, SIGNAL(typeSelected(int)), d->traceView, SLOT(selectByTypeId(int)));
connect(d->traceView, SIGNAL(gotoSourceLocation(QString,int,int)),
d->eventsView, SLOT(selectBySourceLocation(QString,int,int)));
connect(d->traceView, SIGNAL(typeSelected(int)), d->eventsView, SLOT(selectByTypeId(int)));
d->v8profilerView = new QV8ProfilerEventsWidget(mw, d->profilerTool, this,
d->profilerModelManager);

View File

@@ -66,6 +66,7 @@ public:
qint64 duration(int index) const { return ranges[index].duration; }
qint64 startTime(int index) const { return ranges[index].start; }
qint64 endTime(int index) const { return ranges[index].start + ranges[index].duration; }
int typeId(int index) const { return ranges[index].typeId; }
inline qint64 lastEndTime() const { return endTimes.last().end; }
inline qint64 firstStartTime() const { return ranges.first().start; }

View File

@@ -228,6 +228,11 @@ int TimelineModelAggregator::selectionId(int modelIndex, int index) const
return d->modelList[modelIndex]->selectionId(index);
}
int TimelineModelAggregator::typeId(int modelIndex, int index) const
{
return d->modelList[modelIndex]->typeId(index);
}
int TimelineModelAggregator::bindingLoopDest(int modelIndex,int index) const
{
return d->modelList[modelIndex]->bindingLoopDest(index);

View File

@@ -85,6 +85,7 @@ public:
Q_INVOKABLE qint64 startTime(int modelIndex, int index) const;
Q_INVOKABLE qint64 endTime(int modelIndex, int index) const;
Q_INVOKABLE int selectionId(int modelIndex, int index) const;
Q_INVOKABLE int typeId(int modelIndex, int index) const;
Q_INVOKABLE int bindingLoopDest(int modelIndex, int index) const;
Q_INVOKABLE QColor color(int modelIndex, int index) const;
Q_INVOKABLE float relativeHeight(int modelIndex, int index) const;