QmlProfiler: tooltips for the labels column

Due to space restrictions, the descriptive text of events
in the labels column of the timeline view are elided.  This
patch adds tooltips on mouseover with location and details.

Change-Id: I229988e114f21e4d9575dff137aa91918ad1afa3
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2012-01-11 14:46:05 +01:00
parent b43dade44d
commit 5fede0d497
6 changed files with 24 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ Item {
property int typeIndex: index
property variant descriptions: []
property variant extdescriptions: []
property variant eventIds: []
height: root.singleRowHeight
@@ -67,17 +68,21 @@ Item {
onDataReady: {
var desc=[];
var ids=[];
var extdesc=[];
for (var i=0; i<qmlEventList.uniqueEventsOfType(typeIndex); i++) {
desc[i] = qmlEventList.eventTextForType(typeIndex, i);
ids[i] = qmlEventList.eventIdForType(typeIndex, i);
extdesc[i] = qmlEventList.eventDisplayNameForType(typeIndex, i) + " : " + desc[i];
}
descriptions = desc;
eventIds = ids;
extdescriptions = extdesc;
updateHeight();
}
onDataClear: {
descriptions = [];
eventIds = [];
extdescriptions = [];
updateHeight();
}
}
@@ -121,6 +126,9 @@ Item {
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: changeToolTip(extdescriptions[index]);
onExited: changeToolTip("");
onClicked: {
if (mouse.modifiers & Qt.ShiftModifier)
view.selectPrevFromId(eventIds[index]);

View File

@@ -73,6 +73,8 @@ Rectangle {
property variant selectionRangeStart: selectionRange.startTime
property variant selectionRangeEnd: selectionRange.startTime + selectionRange.duration
signal changeToolTip(string text)
// ***** connections with external objects
Connections {
target: zoomControl

View File

@@ -296,6 +296,7 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
connect(this, SIGNAL(globalZoom()), m_mainView->rootObject(), SLOT(globalZoom()));
connect(this, SIGNAL(selectNextEventInDisplay(QVariant)), m_mainView->rootObject(), SLOT(selectNextWithId(QVariant)));
connect(m_mainView->rootObject(), SIGNAL(selectedEventIdChanged(int)), this, SIGNAL(selectedEventIdChanged(int)));
connect(m_mainView->rootObject(), SIGNAL(changeToolTip(QString)), this, SLOT(updateToolTip(QString)));
connect(this, SIGNAL(internalClearDisplay()), m_mainView->rootObject(), SLOT(clearAll()));
connect(this,SIGNAL(internalClearDisplay()), m_overview->rootObject(), SLOT(clearDisplay()));
@@ -563,5 +564,10 @@ void TraceWindow::updateProfilerState()
emit profilerStateChanged(qmlActive, v8Active);
}
void TraceWindow::updateToolTip(QString text)
{
setToolTip(text);
}
} // namespace Internal
} // namespace QmlProfiler

View File

@@ -126,6 +126,7 @@ public slots:
void v8Complete();
void selectNextEvent(int eventId);
void updateProfilerState();
void updateToolTip(QString text);
signals:
void viewUpdated();