forked from qt-creator/qt-creator
QmlProfiler: optimized timeline display
Change-Id: I0d7cf110356ef5f805b81a5fc39dca3870765ea3 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -34,12 +34,53 @@ import QtQuick 1.0
|
||||
|
||||
Item {
|
||||
property alias text: txt.text
|
||||
property bool expanded: false
|
||||
property int typeIndex: index
|
||||
|
||||
height: 50
|
||||
width: 150 //### required, or ignored by positioner
|
||||
property variant descriptions: [text]
|
||||
|
||||
height: root.singleRowHeight
|
||||
width: 150
|
||||
|
||||
onExpandedChanged: {
|
||||
var rE = labels.rowExpanded;
|
||||
rE[typeIndex] = expanded;
|
||||
labels.rowExpanded = rE;
|
||||
backgroundMarks.requestPaint();
|
||||
view.rowExpanded(typeIndex, expanded);
|
||||
updateHeight();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
updateHeight();
|
||||
}
|
||||
|
||||
function updateHeight() {
|
||||
height = root.singleRowHeight *
|
||||
(expanded ? qmlEventList.uniqueEventsOfType(typeIndex) : qmlEventList.maxNestingForType(typeIndex));
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: qmlEventList
|
||||
onDataReady: {
|
||||
var desc=[];
|
||||
for (var i=0; i<qmlEventList.uniqueEventsOfType(typeIndex); i++)
|
||||
desc[i] = qmlEventList.eventTextForType(typeIndex, i);
|
||||
// special case: empty
|
||||
if (desc.length == 1 && desc[0]=="")
|
||||
desc[0] = text;
|
||||
descriptions = desc;
|
||||
updateHeight();
|
||||
}
|
||||
onDataClear: {
|
||||
descriptions = [text];
|
||||
updateHeight();
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txt;
|
||||
id: txt
|
||||
visible: !expanded
|
||||
x: 5
|
||||
font.pixelSize: 12
|
||||
color: "#232323"
|
||||
@@ -52,4 +93,31 @@ Item {
|
||||
color: "#cccccc"
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
|
||||
Column {
|
||||
visible: expanded
|
||||
Repeater {
|
||||
model: descriptions.length
|
||||
Text {
|
||||
height: root.singleRowHeight
|
||||
x: 5
|
||||
width: 140
|
||||
text: descriptions[index]
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
source: expanded ? "arrow_down.png" : "arrow_right.png"
|
||||
x: parent.width - 12
|
||||
y: 2
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
expanded = !expanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user