From 5fede0d497e2cab7455329cb4ef93a420bccd200 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Wed, 11 Jan 2012 14:46:05 +0100 Subject: [PATCH] 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 --- src/libs/qmljsdebugclient/qmlprofilereventlist.cpp | 6 ++++++ src/libs/qmljsdebugclient/qmlprofilereventlist.h | 1 + src/plugins/qmlprofiler/qml/Label.qml | 8 ++++++++ src/plugins/qmlprofiler/qml/MainView.qml | 2 ++ src/plugins/qmlprofiler/tracewindow.cpp | 6 ++++++ src/plugins/qmlprofiler/tracewindow.h | 1 + 6 files changed, 24 insertions(+) diff --git a/src/libs/qmljsdebugclient/qmlprofilereventlist.cpp b/src/libs/qmljsdebugclient/qmlprofilereventlist.cpp index b337c2552bd..a7e02cc4032 100644 --- a/src/libs/qmljsdebugclient/qmlprofilereventlist.cpp +++ b/src/libs/qmljsdebugclient/qmlprofilereventlist.cpp @@ -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; } +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 { if (!d->m_typeCounts.contains(type)) return -1; diff --git a/src/libs/qmljsdebugclient/qmlprofilereventlist.h b/src/libs/qmljsdebugclient/qmlprofilereventlist.h index ff52c87b170..a9fc0454b9c 100644 --- a/src/libs/qmljsdebugclient/qmlprofilereventlist.h +++ b/src/libs/qmljsdebugclient/qmlprofilereventlist.h @@ -150,6 +150,7 @@ public: Q_INVOKABLE int uniqueEventsOfType(int type) const; Q_INVOKABLE int maxNestingForType(int type) 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 eventPosInType(int index) const; diff --git a/src/plugins/qmlprofiler/qml/Label.qml b/src/plugins/qmlprofiler/qml/Label.qml index ac6a47ccae4..9d639820ca0 100644 --- a/src/plugins/qmlprofiler/qml/Label.qml +++ b/src/plugins/qmlprofiler/qml/Label.qml @@ -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; irootObject(), 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 diff --git a/src/plugins/qmlprofiler/tracewindow.h b/src/plugins/qmlprofiler/tracewindow.h index 9e72faf5c5d..26be955d483 100644 --- a/src/plugins/qmlprofiler/tracewindow.h +++ b/src/plugins/qmlprofiler/tracewindow.h @@ -126,6 +126,7 @@ public slots: void v8Complete(); void selectNextEvent(int eventId); void updateProfilerState(); + void updateToolTip(QString text); signals: void viewUpdated();