forked from qt-creator/qt-creator
Tracing: Fix several occurrences of "Unqualified access" in QML code
Courtesy of qmllint via qmlls. Change-Id: I28c0a8f7ec17a93831fd1f5d9d2de5547a633965 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -38,13 +38,14 @@ Item {
|
||||
id: dragArea
|
||||
anchors.fill: txt
|
||||
drag.target: dragger
|
||||
cursorShape: dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursor
|
||||
drag.minimumY: dragging ? 0 : -dragOffset // Account for parent change below
|
||||
drag.maximumY: visibleHeight - (dragging ? 0 : dragOffset)
|
||||
cursorShape: labelContainer.dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursor
|
||||
// Account for parent change below
|
||||
drag.minimumY: labelContainer.dragging ? 0 : -labelContainer.dragOffset
|
||||
drag.maximumY: labelContainer.visibleHeight - (labelContainer.dragging ? 0 : labelContainer.dragOffset)
|
||||
drag.axis: Drag.YAxis
|
||||
hoverEnabled: true
|
||||
ToolTip {
|
||||
text: model.tooltip || labelContainer.text
|
||||
text: labelContainer.model.tooltip || labelContainer.text
|
||||
visible: enabled && parent.containsMouse
|
||||
delay: 1000
|
||||
}
|
||||
@@ -76,30 +77,30 @@ Item {
|
||||
|
||||
text: labelContainer.text
|
||||
color: Theme.color(Theme.PanelTextColorLight)
|
||||
height: model ? model.defaultRowHeight : 0
|
||||
height: labelContainer.model ? labelContainer.model.defaultRowHeight : 0
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Column {
|
||||
id: labelsArea
|
||||
property QtObject parentModel: model
|
||||
property QtObject parentModel: labelContainer.model
|
||||
anchors.top: txt.bottom
|
||||
visible: expanded
|
||||
visible: labelContainer.expanded
|
||||
Repeater {
|
||||
model: expanded ? labels.length : 0
|
||||
model: labelContainer.expanded ? labelContainer.labels.length : 0
|
||||
Loader {
|
||||
id: loader
|
||||
|
||||
// Initially y == 0 for all the items. Don't enable them until they have been moved
|
||||
// into place.
|
||||
property int offset: (index === 0 || y > 0) ? (y + txt.height) : contentHeight
|
||||
active: contentBottom > offset
|
||||
active: labelContainer.contentBottom > offset
|
||||
width: labelContainer.width
|
||||
height: labelsArea.parentModel ? labelsArea.parentModel.rowHeight(index + 1) : 0
|
||||
|
||||
sourceComponent: RowLabel {
|
||||
label: labels[index];
|
||||
label: labelContainer.labels[index];
|
||||
onSelectBySelectionId: {
|
||||
if (labelContainer.model.hasMixedTypesInExpandedState)
|
||||
return;
|
||||
@@ -127,11 +128,12 @@ Item {
|
||||
property var texts: []
|
||||
property int currentNote: -1
|
||||
Connections {
|
||||
target: notesModel
|
||||
target: labelContainer.notesModel
|
||||
function onChanged(typeId, modelId, timelineIndex) {
|
||||
// This will only be called if notesModel != null.
|
||||
if (modelId === -1 || modelId === model.modelId) {
|
||||
var notes = notesModel.byTimelineModel(model.modelId);
|
||||
if (modelId === -1 || modelId === labelContainer.model.modelId) {
|
||||
var notes =
|
||||
labelContainer.notesModel.byTimelineModel(labelContainer.model.modelId);
|
||||
var newTexts = [];
|
||||
var newEventIds = [];
|
||||
for (var i in notes) {
|
||||
@@ -161,11 +163,11 @@ Item {
|
||||
anchors.verticalCenter: txt.verticalCenter
|
||||
anchors.right: parent.right
|
||||
implicitHeight: txt.height - 1
|
||||
enabled: expanded || (model && !model.empty)
|
||||
imageSource: expanded ? "image://icons/close_split" : "image://icons/split"
|
||||
ToolTip.text: expanded ? qsTranslate("Tracing", "Collapse category")
|
||||
enabled: labelContainer.expanded || (labelContainer.model && !labelContainer.model.empty)
|
||||
imageSource: labelContainer.expanded ? "image://icons/close_split" : "image://icons/split"
|
||||
ToolTip.text: labelContainer.expanded ? qsTranslate("Tracing", "Collapse category")
|
||||
: qsTranslate("Tracing", "Expand category")
|
||||
onClicked: model.expanded = !expanded
|
||||
onClicked: labelContainer.model.expanded = !labelContainer.expanded
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -199,7 +201,7 @@ Item {
|
||||
when: dragger.Drag.active
|
||||
ParentChange {
|
||||
target: dragger
|
||||
parent: draggerParent
|
||||
parent: labelContainer.draggerParent
|
||||
}
|
||||
PropertyChanges {
|
||||
target: dragger
|
||||
|
||||
@@ -26,18 +26,18 @@ Item {
|
||||
x: parent === null ? 0 : parent.width * FlameGraph.relativePosition
|
||||
|
||||
Rectangle {
|
||||
border.color: borderColor
|
||||
border.width: borderWidth
|
||||
color: Qt.hsla((level % 12) / 72, 0.9 + Math.random() / 10,
|
||||
border.color: flamegraphItem.borderColor
|
||||
border.width: flamegraphItem.borderWidth
|
||||
color: Qt.hsla((flamegraphItem.level % 12) / 72, 0.9 + Math.random() / 10,
|
||||
0.45 + Math.random() / 10, 0.9 + Math.random() / 10);
|
||||
height: itemHeight;
|
||||
height: flamegraphItem.itemHeight
|
||||
anchors.left: flamegraphItem.left
|
||||
anchors.right: flamegraphItem.right
|
||||
anchors.bottom: flamegraphItem.bottom
|
||||
|
||||
TimelineText {
|
||||
id: text
|
||||
visible: textVisible
|
||||
visible: flamegraphItem.textVisible
|
||||
anchors.fill: parent
|
||||
anchors.margins: 5
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
@@ -45,7 +45,7 @@ Item {
|
||||
text: flamegraphItem.text
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
font.bold: isSelected
|
||||
font.bold: flamegraphItem.isSelected
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -129,7 +129,7 @@ Rectangle {
|
||||
color: Theme.color(Theme.PanelStatusBarBackgroundColor)
|
||||
modelProxy: timelineModelAggregator
|
||||
zoomer: zoomControl
|
||||
reverseSelect: shiftPressed
|
||||
reverseSelect: root.shiftPressed
|
||||
|
||||
onMoveCategories: (sourceIndex, targetIndex) => {
|
||||
content.moveCategories(sourceIndex, targetIndex)
|
||||
@@ -228,7 +228,7 @@ Rectangle {
|
||||
|
||||
MouseArea {
|
||||
id: selectionRangeControl
|
||||
enabled: selectionRangeMode &&
|
||||
enabled: root.selectionRangeMode &&
|
||||
selectionRange.creationState !== selectionRange.creationFinished
|
||||
anchors.right: content.right
|
||||
anchors.left: buttonsBar.right
|
||||
@@ -269,7 +269,7 @@ Rectangle {
|
||||
interactive: false
|
||||
x: content.x
|
||||
y: content.y
|
||||
height: (selectionRangeMode &&
|
||||
height: (root.selectionRangeMode &&
|
||||
selectionRange.creationState !== selectionRange.creationInactive) ?
|
||||
content.height : 0
|
||||
width: content.width
|
||||
@@ -328,7 +328,7 @@ Rectangle {
|
||||
endTime: zoomControl.selectionEnd
|
||||
referenceDuration: zoomControl.rangeDuration
|
||||
showDuration: selectionRange.rangeWidth > 1
|
||||
hasContents: selectionRangeMode &&
|
||||
hasContents: root.selectionRangeMode &&
|
||||
selectionRange.creationState !== selectionRange.creationInactive
|
||||
|
||||
onRecenter: {
|
||||
@@ -356,7 +356,7 @@ Rectangle {
|
||||
locked: content.selectionLocked
|
||||
|
||||
onRecenterOnItem: {
|
||||
content.select(selectedModel, selectedItem)
|
||||
content.select(root.selectedModel, root.selectedItem)
|
||||
}
|
||||
|
||||
onLockedChanged: {
|
||||
@@ -368,10 +368,11 @@ Rectangle {
|
||||
}
|
||||
|
||||
onUpdateNote: (text) => {
|
||||
if (timelineModelAggregator.notes && selectedModel != -1 && selectedItem != -1) {
|
||||
if (timelineModelAggregator.notes && root.selectedModel != -1
|
||||
&& root.selectedItem != -1) {
|
||||
timelineModelAggregator.notes.setText(
|
||||
timelineModelAggregator.models[selectedModel].modelId,
|
||||
selectedItem, text);
|
||||
timelineModelAggregator.models[root.selectedModel].modelId,
|
||||
root.selectedItem, text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ Rectangle {
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: zoomer
|
||||
function onRangeChanged() { updateRangeMover(); }
|
||||
target: overview.zoomer
|
||||
function onRangeChanged() { overview.updateRangeMover(); }
|
||||
}
|
||||
|
||||
TimeDisplay {
|
||||
@@ -59,9 +59,9 @@ Rectangle {
|
||||
height: 10
|
||||
fontSize: 6
|
||||
labelsHeight: 10
|
||||
windowStart: zoomer.traceStart
|
||||
alignedWindowStart: zoomer.traceStart
|
||||
rangeDuration: zoomer.traceDuration
|
||||
windowStart: overview.zoomer.traceStart
|
||||
alignedWindowStart: overview.zoomer.traceStart
|
||||
rangeDuration: overview.zoomer.traceDuration
|
||||
contentX: 0
|
||||
offsetX: 0
|
||||
}
|
||||
@@ -75,35 +75,35 @@ Rectangle {
|
||||
id: renderArea
|
||||
|
||||
Repeater {
|
||||
model: modelProxy.models
|
||||
model: overview.modelProxy.models
|
||||
TimelineOverviewRenderer {
|
||||
model: modelData
|
||||
zoomer: overview.zoomer
|
||||
notes: modelProxy.notes
|
||||
notes: overview.modelProxy.notes
|
||||
width: renderArea.width
|
||||
height: renderArea.height / modelProxy.models.length
|
||||
height: renderArea.height / overview.modelProxy.models.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: noteSigns
|
||||
property var modelsById: modelProxy.models.reduce(function(prev, model) {
|
||||
property var modelsById: overview.modelProxy.models.reduce(function(prev, model) {
|
||||
prev[model.modelId] = model;
|
||||
return prev;
|
||||
}, {});
|
||||
|
||||
property int vertSpace: renderArea.height / 7
|
||||
property color noteColor: Theme.color(Theme.Timeline_HighlightColor)
|
||||
readonly property double spacing: parent.width / zoomer.traceDuration
|
||||
readonly property double spacing: parent.width / overview.zoomer.traceDuration
|
||||
|
||||
model: modelProxy.notes ? modelProxy.notes.count : 0
|
||||
model: overview.modelProxy.notes ? overview.modelProxy.notes.count : 0
|
||||
Item {
|
||||
property int timelineIndex: modelProxy.notes.timelineIndex(index)
|
||||
property int timelineModel: modelProxy.notes.timelineModel(index)
|
||||
property int timelineIndex: overview.modelProxy.notes.timelineIndex(index)
|
||||
property int timelineModel: overview.modelProxy.notes.timelineModel(index)
|
||||
property double startTime: noteSigns.modelsById[timelineModel].startTime(timelineIndex)
|
||||
property double endTime: noteSigns.modelsById[timelineModel].endTime(timelineIndex)
|
||||
x: ((startTime + endTime) / 2 - zoomer.traceStart) * noteSigns.spacing
|
||||
x: ((startTime + endTime) / 2 - overview.zoomer.traceStart) * noteSigns.spacing
|
||||
y: timebar.height + noteSigns.vertSpace
|
||||
height: noteSigns.vertSpace * 5
|
||||
width: 2
|
||||
@@ -156,7 +156,7 @@ Rectangle {
|
||||
|
||||
RangeMover {
|
||||
id: rangeMover
|
||||
visible: modelProxy.height > 0
|
||||
visible: overview.modelProxy.height > 0
|
||||
onRangeLeftChanged: overview.updateZoomer()
|
||||
onRangeRightChanged: overview.updateZoomer()
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ Item {
|
||||
Rectangle {
|
||||
id: titleBar
|
||||
width: parent.width
|
||||
height: titleBarHeight
|
||||
height: rangeDetails.titleBarHeight
|
||||
color: Theme.color(Theme.Timeline_PanelHeaderColor)
|
||||
border.width: borderWidth
|
||||
border.width: rangeDetails.borderWidth
|
||||
border.color: Theme.color(Theme.PanelTextColorMid)
|
||||
|
||||
TimelineText {
|
||||
@@ -72,8 +72,8 @@ Item {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.left: parent.left
|
||||
anchors.right: closeIcon.left
|
||||
anchors.leftMargin: outerMargin
|
||||
anchors.rightMargin: innerMargin
|
||||
anchors.leftMargin: rangeDetails.outerMargin
|
||||
anchors.rightMargin: rangeDetails.innerMargin
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
color: Theme.color(Theme.PanelTextColorLight)
|
||||
@@ -93,11 +93,11 @@ Item {
|
||||
|
||||
ImageToolButton {
|
||||
id: lockIcon
|
||||
imageSource: "image://icons/lock_" + (locked ? "closed" : "open")
|
||||
imageSource: "image://icons/lock_" + (rangeDetails.locked ? "closed" : "open")
|
||||
anchors.top: closeIcon.top
|
||||
anchors.right: closeIcon.left
|
||||
implicitHeight: typeTitle.height
|
||||
onClicked: locked = !locked
|
||||
onClicked: rangeDetails.locked = !rangeDetails.locked
|
||||
ToolTip.text: qsTranslate("Tracing", "View event information on mouseover.")
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: dragHandle.bottom
|
||||
|
||||
border.width: borderWidth
|
||||
border.width: rangeDetails.borderWidth
|
||||
border.color: Theme.color(Theme.PanelTextColorMid)
|
||||
}
|
||||
|
||||
@@ -130,17 +130,17 @@ Item {
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.top: titleBar.bottom
|
||||
anchors.topMargin: innerMargin
|
||||
anchors.leftMargin: outerMargin
|
||||
anchors.rightMargin: outerMargin
|
||||
anchors.topMargin: rangeDetails.innerMargin
|
||||
anchors.leftMargin: rangeDetails.outerMargin
|
||||
anchors.rightMargin: rangeDetails.outerMargin
|
||||
|
||||
spacing: innerMargin
|
||||
spacing: rangeDetails.innerMargin
|
||||
columns: 2
|
||||
|
||||
property int minimumWidth: minimumInnerWidth
|
||||
property int minimumWidth: rangeDetails.minimumInnerWidth
|
||||
onPositioningComplete: {
|
||||
// max(width of longest label * 2, minimumInnerWidth)
|
||||
var result = minimumInnerWidth;
|
||||
var result = rangeDetails.minimumInnerWidth;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].isLabel)
|
||||
result = Math.max(children[i].implicitWidth * 2 + innerMargin, result);
|
||||
@@ -149,12 +149,14 @@ Item {
|
||||
minimumWidth = result + 2 * outerMargin;
|
||||
}
|
||||
|
||||
property int labelWidth: Math.ceil((minimumWidth - innerMargin) / 2) - outerMargin
|
||||
property int valueWidth: dragHandle.x - labelWidth - innerMargin - outerMargin
|
||||
property int labelWidth: Math.ceil((minimumWidth - rangeDetails.innerMargin) / 2)
|
||||
- rangeDetails.outerMargin
|
||||
property int valueWidth: dragHandle.x - labelWidth - rangeDetails.innerMargin
|
||||
- rangeDetails.outerMargin
|
||||
|
||||
onMinimumWidthChanged: {
|
||||
if (dragHandle.x < minimumWidth - outerMargin)
|
||||
dragHandle.x = minimumWidth - outerMargin;
|
||||
if (dragHandle.x < minimumWidth - rangeDetails.outerMargin)
|
||||
dragHandle.x = minimumWidth - rangeDetails.outerMargin;
|
||||
}
|
||||
|
||||
Repeater {
|
||||
@@ -174,9 +176,9 @@ Item {
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: outerMargin
|
||||
anchors.rightMargin: outerMargin
|
||||
anchors.topMargin: visible ? innerMargin : 0
|
||||
anchors.leftMargin: rangeDetails.outerMargin
|
||||
anchors.rightMargin: rangeDetails.outerMargin
|
||||
anchors.topMargin: visible ? rangeDetails.innerMargin : 0
|
||||
anchors.top: col.bottom
|
||||
height: visible ? implicitHeight : 0
|
||||
|
||||
@@ -201,7 +203,7 @@ Item {
|
||||
Timer {
|
||||
id: saveTimer
|
||||
onTriggered: {
|
||||
if (!rangeDetails.readOnly)
|
||||
if (!noteEdit.readOnly)
|
||||
rangeDetails.updateNote(noteEdit.text);
|
||||
}
|
||||
interval: 1000
|
||||
@@ -211,15 +213,15 @@ Item {
|
||||
|
||||
Item {
|
||||
id: dragHandle
|
||||
width: outerMargin
|
||||
height: outerMargin
|
||||
x: initialWidth
|
||||
width: rangeDetails.outerMargin
|
||||
height: rangeDetails.outerMargin
|
||||
x: rangeDetails.initialWidth
|
||||
anchors.top: noteEdit.bottom
|
||||
clip: true
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.target: parent
|
||||
drag.minimumX: col.minimumWidth - outerMargin
|
||||
drag.minimumX: col.minimumWidth - rangeDetails.outerMargin
|
||||
drag.axis: Drag.XAxis
|
||||
cursorShape: Qt.SizeHorCursor
|
||||
}
|
||||
|
||||
@@ -30,7 +30,9 @@ Item {
|
||||
return Qt.rgba(color.r, color.g, color.b, Math.max(Math.min(color.a, 0.7), 0.3));
|
||||
}
|
||||
|
||||
color: width > 1 ? alphaColor(dragArea.pressed ? dragColor : rangeColor) : singleLineColor
|
||||
color: width > 1 ? alphaColor(dragArea.pressed ? rangeMover.dragColor
|
||||
: rangeMover.rangeColor)
|
||||
: rangeMover.singleLineColor
|
||||
}
|
||||
|
||||
Item {
|
||||
@@ -49,7 +51,7 @@ Item {
|
||||
height: parent.height
|
||||
anchors.right: parent.left
|
||||
width: 7
|
||||
color: handleColor
|
||||
color: rangeMover.handleColor
|
||||
visible: false
|
||||
Image {
|
||||
source: "image://icons/range_handle"
|
||||
@@ -72,7 +74,7 @@ Item {
|
||||
anchors.fill: leftBorderHandle
|
||||
|
||||
drag.target: leftRange
|
||||
drag.axis: "XAxis"
|
||||
drag.axis: Drag.XAxis
|
||||
drag.minimumX: 0
|
||||
drag.maximumX: rangeMover.width
|
||||
drag.onActiveChanged: drag.maximumX = rightRange.x
|
||||
@@ -102,7 +104,7 @@ Item {
|
||||
height: parent.height
|
||||
anchors.left: parent.right
|
||||
width: 7
|
||||
color: handleColor
|
||||
color: rangeMover.handleColor
|
||||
visible: false
|
||||
Image {
|
||||
source: "image://icons/range_handle"
|
||||
@@ -125,7 +127,7 @@ Item {
|
||||
anchors.fill: rightBorderHandle
|
||||
|
||||
drag.target: rightRange
|
||||
drag.axis: "XAxis"
|
||||
drag.axis: Drag.XAxis
|
||||
drag.minimumX: 0
|
||||
drag.maximumX: rangeMover.width
|
||||
drag.onActiveChanged: drag.minimumX = leftRange.x
|
||||
@@ -150,7 +152,7 @@ Item {
|
||||
|
||||
anchors.fill: selectedRange
|
||||
drag.target: leftRange
|
||||
drag.axis: "XAxis"
|
||||
drag.axis: Drag.XAxis
|
||||
drag.minimumX: 0
|
||||
drag.maximumX: rangeMover.width - origWidth
|
||||
drag.onActiveChanged: origWidth = selectedRange.width
|
||||
|
||||
@@ -42,7 +42,7 @@ Button {
|
||||
onPressed: resizing = true
|
||||
onReleased: resizing = false
|
||||
|
||||
height: dragHeight
|
||||
height: button.dragHeight
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
@@ -45,8 +45,8 @@ RangeMover {
|
||||
onRangeLeftChanged: updateZoomer()
|
||||
|
||||
Connections {
|
||||
target: zoomer
|
||||
function onWindowChanged() { updateRange(); }
|
||||
target: selectionRange.zoomer
|
||||
function onWindowChanged() { selectionRange.updateRange(); }
|
||||
}
|
||||
|
||||
function setPos(pos) {
|
||||
|
||||
@@ -25,8 +25,8 @@ Item {
|
||||
// keep inside view
|
||||
Connections {
|
||||
target: selectionRangeDetails.parent
|
||||
function onWidthChanged() { fitInView(); }
|
||||
function onHeightChanged() { fitInView(); }
|
||||
function onWidthChanged() { selectionRangeDetails.fitInView(); }
|
||||
function onHeightChanged() { selectionRangeDetails.fitInView(); }
|
||||
}
|
||||
|
||||
function fitInView() {
|
||||
@@ -79,14 +79,17 @@ Item {
|
||||
id: details
|
||||
property var contents: [
|
||||
qsTranslate("Tracing", "Start") + ":",
|
||||
TimeFormatter.format(startTime, referenceDuration),
|
||||
TimeFormatter.format(selectionRangeDetails.startTime,
|
||||
selectionRangeDetails.referenceDuration),
|
||||
(qsTranslate("Tracing", "End") + ":"),
|
||||
TimeFormatter.format(endTime, referenceDuration),
|
||||
TimeFormatter.format(selectionRangeDetails.endTime,
|
||||
selectionRangeDetails.referenceDuration),
|
||||
(qsTranslate("Tracing", "Duration") + ":"),
|
||||
TimeFormatter.format(duration, referenceDuration)
|
||||
TimeFormatter.format(selectionRangeDetails.duration,
|
||||
selectionRangeDetails.referenceDuration)
|
||||
]
|
||||
|
||||
model: showDuration ? 6 : 2
|
||||
model: selectionRangeDetails.showDuration ? 6 : 2
|
||||
Detail {
|
||||
isLabel: index % 2 === 0
|
||||
text: details.contents[index]
|
||||
|
||||
@@ -40,7 +40,8 @@ Item {
|
||||
id: timeDisplayArea
|
||||
|
||||
property int firstBlock: timeDisplay.offsetX / timeDisplay.pixelsPerBlock
|
||||
property int offset: repeater.model > 0 ? repeater.model - (firstBlock % repeater.model) : 0;
|
||||
property int offset: repeater.model > 0 ? repeater.model - (firstBlock % repeater.model)
|
||||
: 0;
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
@@ -78,11 +78,11 @@ Item {
|
||||
property double maxVal: scope.model ? scope.model.rowMaxValue(index) : 0
|
||||
property double valDiff: maxVal - minVal
|
||||
property bool scaleVisible: scope.model && scope.model.expanded &&
|
||||
height > scaleMinHeight && valDiff > 0
|
||||
height > timeMarks.scaleMinHeight && valDiff > 0
|
||||
|
||||
property double stepVal: {
|
||||
var ret = 1;
|
||||
var ugly = Math.ceil(valDiff / Math.floor(height / scaleStepping));
|
||||
var ugly = Math.ceil(valDiff / Math.floor(height / timeMarks.scaleStepping));
|
||||
while (isFinite(ugly) && ugly > 1) {
|
||||
ugly /= 2;
|
||||
ret *= 2;
|
||||
@@ -122,7 +122,8 @@ Item {
|
||||
anchors.bottomMargin: 2
|
||||
anchors.leftMargin: 2
|
||||
anchors.left: parent.left
|
||||
text: prettyPrintScale(scaleItem.minVal + index * scaleItem.stepVal)
|
||||
text: prettyPrintScale(scaleItem.minVal
|
||||
+ index * scaleItem.stepVal)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -96,11 +96,11 @@ Flickable {
|
||||
|
||||
DelegateModel {
|
||||
id: timelineModel
|
||||
model: modelProxy.models
|
||||
model: flick.modelProxy.models
|
||||
delegate: TimelineRenderer {
|
||||
id: renderer
|
||||
model: modelData
|
||||
notes: modelProxy.notes
|
||||
notes: flick.modelProxy.notes
|
||||
zoomer: flick.zoomer
|
||||
selectionLocked: flick.selectionLocked
|
||||
x: 0
|
||||
@@ -124,29 +124,29 @@ Flickable {
|
||||
}
|
||||
|
||||
function recenter() {
|
||||
if (modelData.endTime(selectedItem) < zoomer.rangeStart ||
|
||||
modelData.startTime(selectedItem) > zoomer.rangeEnd) {
|
||||
if (modelData.endTime(renderer.selectedItem) < zoomer.rangeStart ||
|
||||
modelData.startTime(renderer.selectedItem) > zoomer.rangeEnd) {
|
||||
|
||||
var newStart = Math.max((modelData.startTime(selectedItem) +
|
||||
modelData.endTime(selectedItem) -
|
||||
var newStart = Math.max((modelData.startTime(renderer.selectedItem) +
|
||||
modelData.endTime(renderer.selectedItem) -
|
||||
zoomer.rangeDuration) / 2, zoomer.traceStart);
|
||||
zoomer.setRange(newStart,
|
||||
Math.min(newStart + zoomer.rangeDuration, zoomer.traceEnd));
|
||||
}
|
||||
|
||||
var row = modelData.row(selectedItem);
|
||||
var row = renderer.model.row(renderer.selectedItem);
|
||||
var rowStart = modelData.rowOffset(row) + y;
|
||||
var rowEnd = rowStart + modelData.rowHeight(row);
|
||||
if (rowStart < flick.contentY || rowEnd - flick.height > flick.contentY)
|
||||
flick.contentY = (rowStart + rowEnd - flick.height) / 2;
|
||||
}
|
||||
|
||||
onSelectedItemChanged: flick.propagateSelection(index, selectedItem);
|
||||
onSelectedItemChanged: flick.propagateSelection(index, renderer.selectedItem);
|
||||
|
||||
Connections {
|
||||
target: model
|
||||
target: renderer.model
|
||||
function onDetailsChanged() {
|
||||
if (selectedItem != -1) {
|
||||
if (renderer.selectedItem != -1) {
|
||||
flick.propagateSelection(-1, -1);
|
||||
flick.propagateSelection(index, selectedItem);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ Flickable {
|
||||
|
||||
// As we cannot retrieve items by visible index we keep an array of row counts here,
|
||||
// for the time marks to draw the row backgrounds in the right colors.
|
||||
property var rowCounts: new Array(modelProxy.models.length)
|
||||
property var rowCounts: new Array(categories.modelProxy.models.length)
|
||||
|
||||
function updateRowCount(visualIndex, rowCount) {
|
||||
if (rowCounts[visualIndex] !== rowCount) {
|
||||
@@ -48,7 +48,7 @@ Flickable {
|
||||
}
|
||||
}
|
||||
|
||||
model: modelProxy.models
|
||||
model: categories.modelProxy.models
|
||||
delegate: Loader {
|
||||
id: loader
|
||||
asynchronous: y < categories.contentY + categories.height &&
|
||||
@@ -73,7 +73,7 @@ Flickable {
|
||||
CategoryLabel {
|
||||
id: label
|
||||
model: modelData
|
||||
notesModel: modelProxy.notes
|
||||
notesModel: categories.modelProxy.notes
|
||||
visualIndex: loader.visualIndex
|
||||
dragging: categories.dragging
|
||||
reverseSelect: categories.reverseSelect
|
||||
@@ -114,7 +114,7 @@ Flickable {
|
||||
TimeMarks {
|
||||
id: timeMarks
|
||||
model: modelData
|
||||
mockup: modelProxy.height === 0
|
||||
mockup: categories.modelProxy.height === 0
|
||||
anchors.right: parent.right
|
||||
anchors.left: label.right
|
||||
anchors.top: parent.top
|
||||
|
||||
@@ -20,7 +20,7 @@ Item {
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: scaleHeight
|
||||
height: rulersParent.scaleHeight
|
||||
|
||||
onClicked: (mouse) => {
|
||||
rulersModel.append({
|
||||
@@ -36,7 +36,8 @@ Item {
|
||||
if (index >= 0) {
|
||||
rulersModel.setProperty(
|
||||
index, "timestamp",
|
||||
(x + contentX) * viewTimePerPixel + windowStart);
|
||||
(x + rulersParent.contentX) * rulersParent.viewTimePerPixel
|
||||
+ rulersParent.windowStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,14 +47,15 @@ Item {
|
||||
|
||||
Item {
|
||||
id: ruler
|
||||
x: (timestamp - windowStart) / viewTimePerPixel - 1 - contentX
|
||||
x: (timestamp - rulersParent.windowStart) / rulersParent.viewTimePerPixel
|
||||
- 1 - rulersParent.contentX
|
||||
y: 0
|
||||
width: 2
|
||||
height: rulersParent.height
|
||||
Rectangle {
|
||||
id: arrow
|
||||
height: scaleHeight
|
||||
width: scaleHeight
|
||||
height: rulersParent.scaleHeight
|
||||
width: rulersParent.scaleHeight
|
||||
rotation: 45
|
||||
anchors.verticalCenter: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -86,7 +88,7 @@ Item {
|
||||
Rectangle {
|
||||
anchors.top: arrow.bottom
|
||||
anchors.horizontalCenter: ruler.horizontalCenter
|
||||
width: scaleHeight / 4
|
||||
width: rulersParent.scaleHeight / 4
|
||||
height: width
|
||||
color: Theme.color(Theme.Timeline_PanelBackgroundColor)
|
||||
|
||||
|
||||
@@ -11,4 +11,3 @@ Text {
|
||||
renderType: Text.NativeRendering
|
||||
color: Theme.color(Theme.Timeline_TextColor)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user