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

@@ -1672,6 +1672,12 @@ QString QmlProfilerEventList::eventTextForType(int type, int index) const {
return d->m_eventDescriptions.values().at(d->m_typeCounts[type]->eventIds[index])->details; return d->m_eventDescriptions.values().at(d->m_typeCounts[type]->eventIds[index])->details;
} }
QString QmlProfilerEventList::eventDisplayNameForType(int type, int index) const {
if (!d->m_typeCounts.contains(type))
return QString();
return d->m_eventDescriptions.values().at(d->m_typeCounts[type]->eventIds[index])->displayname;
}
int QmlProfilerEventList::eventIdForType(int type, int index) const { int QmlProfilerEventList::eventIdForType(int type, int index) const {
if (!d->m_typeCounts.contains(type)) if (!d->m_typeCounts.contains(type))
return -1; return -1;

View File

@@ -150,6 +150,7 @@ public:
Q_INVOKABLE int uniqueEventsOfType(int type) const; Q_INVOKABLE int uniqueEventsOfType(int type) const;
Q_INVOKABLE int maxNestingForType(int type) const; Q_INVOKABLE int maxNestingForType(int type) const;
Q_INVOKABLE QString eventTextForType(int type, int index) const; Q_INVOKABLE QString eventTextForType(int type, int index) const;
Q_INVOKABLE QString eventDisplayNameForType(int type, int index) const;
Q_INVOKABLE int eventIdForType(int type, int index) const; Q_INVOKABLE int eventIdForType(int type, int index) const;
Q_INVOKABLE int eventPosInType(int index) const; Q_INVOKABLE int eventPosInType(int index) const;

View File

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

View File

@@ -73,6 +73,8 @@ Rectangle {
property variant selectionRangeStart: selectionRange.startTime property variant selectionRangeStart: selectionRange.startTime
property variant selectionRangeEnd: selectionRange.startTime + selectionRange.duration property variant selectionRangeEnd: selectionRange.startTime + selectionRange.duration
signal changeToolTip(string text)
// ***** connections with external objects // ***** connections with external objects
Connections { Connections {
target: zoomControl 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(globalZoom()), m_mainView->rootObject(), SLOT(globalZoom()));
connect(this, SIGNAL(selectNextEventInDisplay(QVariant)), m_mainView->rootObject(), SLOT(selectNextWithId(QVariant))); 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(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_mainView->rootObject(), SLOT(clearAll()));
connect(this,SIGNAL(internalClearDisplay()), m_overview->rootObject(), SLOT(clearDisplay())); connect(this,SIGNAL(internalClearDisplay()), m_overview->rootObject(), SLOT(clearDisplay()));
@@ -563,5 +564,10 @@ void TraceWindow::updateProfilerState()
emit profilerStateChanged(qmlActive, v8Active); emit profilerStateChanged(qmlActive, v8Active);
} }
void TraceWindow::updateToolTip(QString text)
{
setToolTip(text);
}
} // namespace Internal } // namespace Internal
} // namespace QmlProfiler } // namespace QmlProfiler

View File

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