diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index 0938f6c1a81..9b10afba9b5 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -107,7 +107,7 @@ Rectangle {
flick.contentWidth = 0;
view.clearData();
view.startTime = view.endTime = 0;
- hideRangeDetails();
+ rangeDetails.hide();
selectionRangeMode = false;
buttonsBar.updateRangeButton(selectionRangeMode);
zoomControl.setRange(0,0);
@@ -151,16 +151,6 @@ Rectangle {
Math.max(0, totalRowOffset - flick.height / 2));
}
- function hideRangeDetails() {
- rangeDetails.visible = false;
- rangeDetails.duration = "";
- rangeDetails.label = "";
- rangeDetails.file = "";
- rangeDetails.line = -1;
- rangeDetails.column = 0;
- rangeDetails.isBindingLoop = false;
- }
-
function selectBySelectionId(modelIndex, selectionId)
{
if (selectionId === -1 || (modelIndex === view.selectedModel && view.selectedItem !== -1 &&
@@ -368,10 +358,7 @@ Rectangle {
onSelectionChanged: {
if (selectedItem !== -1) {
// display details
- rangeDetails.showInfo(qmlProfilerModelProxy.details(selectedModel,
- selectedItem));
- rangeDetails.setLocation(qmlProfilerModelProxy.location(selectedModel,
- selectedItem));
+ rangeDetails.showInfo(selectedModel, selectedItem);
// center view (horizontally)
recenterOnItem(selectedModel, selectedItem);
@@ -388,7 +375,7 @@ Rectangle {
lockItemSelection = false;
}
} else {
- root.hideRangeDetails();
+ rangeDetails.hide();
}
}
diff --git a/src/plugins/qmlprofiler/qml/RangeDetails.qml b/src/plugins/qmlprofiler/qml/RangeDetails.qml
index 3d4b4c2ff11..aa2c4534bc5 100644
--- a/src/plugins/qmlprofiler/qml/RangeDetails.qml
+++ b/src/plugins/qmlprofiler/qml/RangeDetails.qml
@@ -42,6 +42,9 @@ Item {
property int column
property bool isBindingLoop
+ property int selectedModel: -1
+ property int selectedItem: -1
+
property bool locked: view.selectionLocked
width: col.width + 25
@@ -51,6 +54,19 @@ Item {
x: 200
y: 25
+ function hide() {
+ noteEdit.focus = false;
+ visible = false;
+ selectedModel = selectedItem = -1;
+ noteEdit.text = "";
+ duration = "";
+ label = "";
+ file = "";
+ line = -1;
+ column = 0;
+ isBindingLoop = false;
+ }
+
// keep inside view
Connections {
target: root
@@ -62,7 +78,13 @@ Item {
id: eventInfo
}
- function showInfo(eventData) {
+ function showInfo(model, item) {
+ // make sure we don't accidentally save the old text for the new event
+ noteEdit.focus = false;
+
+ selectedModel = model;
+ selectedItem = item;
+ var eventData = qmlProfilerModelProxy.details(selectedModel, selectedItem)
eventInfo.clear();
for (var k in eventData) {
if (k === "displayName") {
@@ -73,9 +95,8 @@ Item {
}
}
rangeDetails.visible = true;
- }
- function setLocation(location) {
+ var location = qmlProfilerModelProxy.location(selectedModel, selectedItem)
if (location.hasOwnProperty("file")) { // not empty
file = location.file;
line = location.line;
@@ -86,6 +107,9 @@ Item {
line = 0;
column = -1;
}
+
+ noteEdit.focus = false;
+ noteEdit.text = qmlProfilerModelProxy.noteText(selectedModel, selectedItem);
}
function fitInView() {
@@ -160,7 +184,7 @@ Item {
Rectangle {
color: "white"
width: parent.width
- height: col.height + 10
+ height: 10 + col.height + (noteEdit.visible ? (noteEdit.height + 5) : 0)
y: 20
border.width: 1
border.color: "#a0a0a0"
@@ -181,6 +205,40 @@ Item {
}
}
}
+
+
+ TextEdit {
+ id: noteEdit
+ x: 10
+ anchors.topMargin: 5
+ anchors.bottomMargin: 5
+ anchors.top: col.bottom
+
+ visible: text.length > 0 || focus
+ width: col.width
+ wrapMode: Text.Wrap
+ color: "orange"
+ font.italic: true
+ renderType: Text.NativeRendering
+ selectByMouse: true
+ onTextChanged: saveTimer.restart()
+ onFocusChanged: {
+ if (!focus && selectedModel != -1 && selectedItem != -1) {
+ saveTimer.stop();
+ qmlProfilerModelProxy.setNoteText(selectedModel, selectedItem, text);
+ }
+ }
+
+ Timer {
+ id: saveTimer
+ onTriggered: {
+ if (selectedModel != -1 && selectedItem != -1)
+ qmlProfilerModelProxy.setNoteText(selectedModel, selectedItem,
+ noteEdit.text);
+ }
+ interval: 1000
+ }
+ }
}
MouseArea {
@@ -196,6 +254,20 @@ Item {
}
}
+ Image {
+ id: editIcon
+ source: "ico_edit.png"
+ anchors.top: closeIcon.top
+ anchors.right: lockIcon.left
+ anchors.rightMargin: 4
+ width: 8
+ height: 12
+ MouseArea {
+ anchors.fill: parent
+ onClicked: noteEdit.focus = true
+ }
+ }
+
Image {
id: lockIcon
source: locked?"lock_closed.png" : "lock_open.png"
@@ -223,7 +295,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
- root.hideRangeDetails();
+ rangeDetails.hide();
view.selectFromEventIndex(view.selectedModel, -1);
}
}
diff --git a/src/plugins/qmlprofiler/qml/ico_edit.png b/src/plugins/qmlprofiler/qml/ico_edit.png
new file mode 100644
index 00000000000..f235e86c839
Binary files /dev/null and b/src/plugins/qmlprofiler/qml/ico_edit.png differ
diff --git a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc
index c2ef6550f1b..51f55b7d6fb 100644
--- a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc
+++ b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc
@@ -11,6 +11,7 @@
recordOn.png
lock_closed.png
lock_open.png
+ ico_edit.png
TimeMarks.qml
Overview.qml
Overview.js