diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-06-09 09:30:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-07-19 13:49:46 +0000 |
commit | 07b01477148287687c029d16362811a509c3f658 (patch) | |
tree | 0e88fca2b51dca6241883b662d0b667f1b43027d /src/libs/tracing | |
parent | 715e304f93604659eb91f77ee7224b04fc916c09 (diff) | |
download | qt-creator-07b01477148287687c029d16362811a509c3f658.tar.gz |
Tracing: Add some civilization to TimeMarks.qml
Use concrete types and annotate JavaScript methods.
Change-Id: If636741181d0ae28605f3f37b46d9011130f5988
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/libs/tracing')
-rw-r--r-- | src/libs/tracing/qml/TimeMarks.qml | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/libs/tracing/qml/TimeMarks.qml b/src/libs/tracing/qml/TimeMarks.qml index 5bf303b4df..f2dbf870da 100644 --- a/src/libs/tracing/qml/TimeMarks.qml +++ b/src/libs/tracing/qml/TimeMarks.qml @@ -29,7 +29,7 @@ import QtCreator.Tracing Item { id: timeMarks visible: model && (mockup || (!model.hidden && !model.empty)) - property QtObject model + property TimelineModel model property bool startOdd property bool mockup @@ -40,7 +40,7 @@ Item { property int rowCount: model ? model.rowCount : 0 - function roundTo3Digits(number) { + function roundTo3Digits(number: real) : real { var factor; if (number < 10) @@ -53,7 +53,7 @@ Item { return Math.round(number * factor) / factor; } - function prettyPrintScale(amount) { + function prettyPrintScale(amount: real) : string { var sign; if (amount < 0) { sign = "-"; @@ -69,9 +69,9 @@ Item { } Connections { - target: model - function onExpandedRowHeightChanged(row, height) { - if (model && model.expanded && row >= 0) + target: timeMarks.model + function onExpandedRowHeightChanged(row: real, height: real) { + if (timeMarks.model && timeMarks.model.expanded && row >= 0) rowRepeater.itemAt(row).height = height; } } @@ -86,17 +86,20 @@ Item { model: timeMarks.rowCount Rectangle { id: scaleItem - color: ((index + (startOdd ? 1 : 0)) % 2) + required property int index + property TimeMarks scope: timeMarks + + color: ((index + (scope.startOdd ? 1 : 0)) % 2) ? Theme.color(Theme.Timeline_BackgroundColor1) : Theme.color(Theme.Timeline_BackgroundColor2) anchors.left: scaleArea.left anchors.right: scaleArea.right - height: timeMarks.model ? timeMarks.model.rowHeight(index) : 0 + height: scope.model ? scope.model.rowHeight(index) : 0 - property double minVal: timeMarks.model ? timeMarks.model.rowMinValue(index) : 0 - property double maxVal: timeMarks.model ? timeMarks.model.rowMaxValue(index) : 0 + property double minVal: scope.model ? scope.model.rowMinValue(index) : 0 + property double maxVal: scope.model ? scope.model.rowMaxValue(index) : 0 property double valDiff: maxVal - minVal - property bool scaleVisible: timeMarks.model && timeMarks.model.expanded && + property bool scaleVisible: scope.model && scope.model.expanded && height > scaleMinHeight && valDiff > 0 property double stepVal: { |