forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -126,6 +126,7 @@ public slots:
|
||||
void v8Complete();
|
||||
void selectNextEvent(int eventId);
|
||||
void updateProfilerState();
|
||||
void updateToolTip(QString text);
|
||||
|
||||
signals:
|
||||
void viewUpdated();
|
||||
|
||||
Reference in New Issue
Block a user