From bac3b888fcd09dde2f255534f517cbbbf140c4c4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 26 Sep 2014 15:40:11 +0200 Subject: [PATCH] QmlProfiler: Show note indication in category labels Change-Id: I9bcb9bcaab6d24c87c932fce610a6026461a5ecb Reviewed-by: Kai Koehne --- src/plugins/qmlprofiler/qml/CategoryLabel.qml | 42 ++++++++++++++++++ src/plugins/qmlprofiler/qml/ico_note.png | Bin 0 -> 117 bytes src/plugins/qmlprofiler/qml/qmlprofiler.qrc | 1 + 3 files changed, 43 insertions(+) create mode 100644 src/plugins/qmlprofiler/qml/ico_note.png diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml index ae716c2216f..3550d7d27b5 100644 --- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml +++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml @@ -193,6 +193,48 @@ Item { } } + ToolButton { + id: notesButton + anchors.verticalCenter: txt.verticalCenter + anchors.right: expandButton.left + implicitWidth: 17 + implicitHeight: txt.height - 1 + property var eventIds: [] + property var texts: [] + property int currentNote: -1 + Connections { + target: qmlProfilerModelProxy + onModelsChanged: notesButton.updateNotes() + onNotesChanged: { + if (arguments[1] === -1 || arguments[1] === modelIndex) + notesButton.updateNotes(); + } + } + + function updateNotes() { + var notes = qmlProfilerModelProxy.notesByTimelineModel(modelIndex); + var newTexts = []; + var newEventIds = []; + for (var i in notes) { + newTexts.push(qmlProfilerModelProxy.noteText(notes[i])) + newEventIds.push(qmlProfilerModelProxy.noteTimelineIndex(notes[i])); + } + + // Bindings are only triggered when assigning the whole array. + eventIds = newEventIds; + texts = newTexts; + } + + visible: eventIds.length > 0 + iconSource: "ico_note.png" + tooltip: texts.join("\n"); + onClicked: { + if (++currentNote >= eventIds.length) + currentNote = 0; + view.selectFromEventIndex(modelIndex, eventIds[currentNote]); + } + } + ToolButton { id: expandButton anchors.verticalCenter: txt.verticalCenter diff --git a/src/plugins/qmlprofiler/qml/ico_note.png b/src/plugins/qmlprofiler/qml/ico_note.png new file mode 100644 index 0000000000000000000000000000000000000000..fa5c2b5bc957294d486a757e3bb677908b1a8920 GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0y~yVBiK}4mJh`hLvl|)fgBU*pj^6T^Rm@;DWu&Co?cG zXnDFghDcma{`3F8Ju_Ftu?~TbU*|h?jvjGflK9poY1qWapKwq>azX(c!(L$?L8ljo S${83K7(8A5T-G@yGywn<9V0&g literal 0 HcmV?d00001 diff --git a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc index 51f55b7d6fb..0e13b920550 100644 --- a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc +++ b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc @@ -27,6 +27,7 @@ ico_next.png ico_rangeselection.png ico_rangeselected.png + ico_note.png ButtonsBar.qml ico_filter.png