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:
Alessandro Portale
2022-10-14 13:30:50 +02:00
parent 86d41d58a8
commit e36ff27403
15 changed files with 126 additions and 113 deletions

View File

@@ -38,13 +38,14 @@ Item {
id: dragArea id: dragArea
anchors.fill: txt anchors.fill: txt
drag.target: dragger drag.target: dragger
cursorShape: dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursor cursorShape: labelContainer.dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursor
drag.minimumY: dragging ? 0 : -dragOffset // Account for parent change below // Account for parent change below
drag.maximumY: visibleHeight - (dragging ? 0 : dragOffset) drag.minimumY: labelContainer.dragging ? 0 : -labelContainer.dragOffset
drag.maximumY: labelContainer.visibleHeight - (labelContainer.dragging ? 0 : labelContainer.dragOffset)
drag.axis: Drag.YAxis drag.axis: Drag.YAxis
hoverEnabled: true hoverEnabled: true
ToolTip { ToolTip {
text: model.tooltip || labelContainer.text text: labelContainer.model.tooltip || labelContainer.text
visible: enabled && parent.containsMouse visible: enabled && parent.containsMouse
delay: 1000 delay: 1000
} }
@@ -76,30 +77,30 @@ Item {
text: labelContainer.text text: labelContainer.text
color: Theme.color(Theme.PanelTextColorLight) color: Theme.color(Theme.PanelTextColorLight)
height: model ? model.defaultRowHeight : 0 height: labelContainer.model ? labelContainer.model.defaultRowHeight : 0
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
} }
Column { Column {
id: labelsArea id: labelsArea
property QtObject parentModel: model property QtObject parentModel: labelContainer.model
anchors.top: txt.bottom anchors.top: txt.bottom
visible: expanded visible: labelContainer.expanded
Repeater { Repeater {
model: expanded ? labels.length : 0 model: labelContainer.expanded ? labelContainer.labels.length : 0
Loader { Loader {
id: loader id: loader
// Initially y == 0 for all the items. Don't enable them until they have been moved // Initially y == 0 for all the items. Don't enable them until they have been moved
// into place. // into place.
property int offset: (index === 0 || y > 0) ? (y + txt.height) : contentHeight property int offset: (index === 0 || y > 0) ? (y + txt.height) : contentHeight
active: contentBottom > offset active: labelContainer.contentBottom > offset
width: labelContainer.width width: labelContainer.width
height: labelsArea.parentModel ? labelsArea.parentModel.rowHeight(index + 1) : 0 height: labelsArea.parentModel ? labelsArea.parentModel.rowHeight(index + 1) : 0
sourceComponent: RowLabel { sourceComponent: RowLabel {
label: labels[index]; label: labelContainer.labels[index];
onSelectBySelectionId: { onSelectBySelectionId: {
if (labelContainer.model.hasMixedTypesInExpandedState) if (labelContainer.model.hasMixedTypesInExpandedState)
return; return;
@@ -127,11 +128,12 @@ Item {
property var texts: [] property var texts: []
property int currentNote: -1 property int currentNote: -1
Connections { Connections {
target: notesModel target: labelContainer.notesModel
function onChanged(typeId, modelId, timelineIndex) { function onChanged(typeId, modelId, timelineIndex) {
// This will only be called if notesModel != null. // This will only be called if notesModel != null.
if (modelId === -1 || modelId === model.modelId) { if (modelId === -1 || modelId === labelContainer.model.modelId) {
var notes = notesModel.byTimelineModel(model.modelId); var notes =
labelContainer.notesModel.byTimelineModel(labelContainer.model.modelId);
var newTexts = []; var newTexts = [];
var newEventIds = []; var newEventIds = [];
for (var i in notes) { for (var i in notes) {
@@ -161,11 +163,11 @@ Item {
anchors.verticalCenter: txt.verticalCenter anchors.verticalCenter: txt.verticalCenter
anchors.right: parent.right anchors.right: parent.right
implicitHeight: txt.height - 1 implicitHeight: txt.height - 1
enabled: expanded || (model && !model.empty) enabled: labelContainer.expanded || (labelContainer.model && !labelContainer.model.empty)
imageSource: expanded ? "image://icons/close_split" : "image://icons/split" imageSource: labelContainer.expanded ? "image://icons/close_split" : "image://icons/split"
ToolTip.text: expanded ? qsTranslate("Tracing", "Collapse category") ToolTip.text: labelContainer.expanded ? qsTranslate("Tracing", "Collapse category")
: qsTranslate("Tracing", "Expand category") : qsTranslate("Tracing", "Expand category")
onClicked: model.expanded = !expanded onClicked: labelContainer.model.expanded = !labelContainer.expanded
} }
Rectangle { Rectangle {
@@ -199,7 +201,7 @@ Item {
when: dragger.Drag.active when: dragger.Drag.active
ParentChange { ParentChange {
target: dragger target: dragger
parent: draggerParent parent: labelContainer.draggerParent
} }
PropertyChanges { PropertyChanges {
target: dragger target: dragger

View File

@@ -26,18 +26,18 @@ Item {
x: parent === null ? 0 : parent.width * FlameGraph.relativePosition x: parent === null ? 0 : parent.width * FlameGraph.relativePosition
Rectangle { Rectangle {
border.color: borderColor border.color: flamegraphItem.borderColor
border.width: borderWidth border.width: flamegraphItem.borderWidth
color: Qt.hsla((level % 12) / 72, 0.9 + Math.random() / 10, color: Qt.hsla((flamegraphItem.level % 12) / 72, 0.9 + Math.random() / 10,
0.45 + Math.random() / 10, 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.left: flamegraphItem.left
anchors.right: flamegraphItem.right anchors.right: flamegraphItem.right
anchors.bottom: flamegraphItem.bottom anchors.bottom: flamegraphItem.bottom
TimelineText { TimelineText {
id: text id: text
visible: textVisible visible: flamegraphItem.textVisible
anchors.fill: parent anchors.fill: parent
anchors.margins: 5 anchors.margins: 5
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@@ -45,7 +45,7 @@ Item {
text: flamegraphItem.text text: flamegraphItem.text
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere
font.bold: isSelected font.bold: flamegraphItem.isSelected
} }
MouseArea { MouseArea {

View File

@@ -129,7 +129,7 @@ Rectangle {
color: Theme.color(Theme.PanelStatusBarBackgroundColor) color: Theme.color(Theme.PanelStatusBarBackgroundColor)
modelProxy: timelineModelAggregator modelProxy: timelineModelAggregator
zoomer: zoomControl zoomer: zoomControl
reverseSelect: shiftPressed reverseSelect: root.shiftPressed
onMoveCategories: (sourceIndex, targetIndex) => { onMoveCategories: (sourceIndex, targetIndex) => {
content.moveCategories(sourceIndex, targetIndex) content.moveCategories(sourceIndex, targetIndex)
@@ -228,7 +228,7 @@ Rectangle {
MouseArea { MouseArea {
id: selectionRangeControl id: selectionRangeControl
enabled: selectionRangeMode && enabled: root.selectionRangeMode &&
selectionRange.creationState !== selectionRange.creationFinished selectionRange.creationState !== selectionRange.creationFinished
anchors.right: content.right anchors.right: content.right
anchors.left: buttonsBar.right anchors.left: buttonsBar.right
@@ -269,7 +269,7 @@ Rectangle {
interactive: false interactive: false
x: content.x x: content.x
y: content.y y: content.y
height: (selectionRangeMode && height: (root.selectionRangeMode &&
selectionRange.creationState !== selectionRange.creationInactive) ? selectionRange.creationState !== selectionRange.creationInactive) ?
content.height : 0 content.height : 0
width: content.width width: content.width
@@ -328,7 +328,7 @@ Rectangle {
endTime: zoomControl.selectionEnd endTime: zoomControl.selectionEnd
referenceDuration: zoomControl.rangeDuration referenceDuration: zoomControl.rangeDuration
showDuration: selectionRange.rangeWidth > 1 showDuration: selectionRange.rangeWidth > 1
hasContents: selectionRangeMode && hasContents: root.selectionRangeMode &&
selectionRange.creationState !== selectionRange.creationInactive selectionRange.creationState !== selectionRange.creationInactive
onRecenter: { onRecenter: {
@@ -356,7 +356,7 @@ Rectangle {
locked: content.selectionLocked locked: content.selectionLocked
onRecenterOnItem: { onRecenterOnItem: {
content.select(selectedModel, selectedItem) content.select(root.selectedModel, root.selectedItem)
} }
onLockedChanged: { onLockedChanged: {
@@ -368,10 +368,11 @@ Rectangle {
} }
onUpdateNote: (text) => { onUpdateNote: (text) => {
if (timelineModelAggregator.notes && selectedModel != -1 && selectedItem != -1) { if (timelineModelAggregator.notes && root.selectedModel != -1
&& root.selectedItem != -1) {
timelineModelAggregator.notes.setText( timelineModelAggregator.notes.setText(
timelineModelAggregator.models[selectedModel].modelId, timelineModelAggregator.models[root.selectedModel].modelId,
selectedItem, text); root.selectedItem, text);
} }
} }

View File

@@ -46,8 +46,8 @@ Rectangle {
} }
Connections { Connections {
target: zoomer target: overview.zoomer
function onRangeChanged() { updateRangeMover(); } function onRangeChanged() { overview.updateRangeMover(); }
} }
TimeDisplay { TimeDisplay {
@@ -59,9 +59,9 @@ Rectangle {
height: 10 height: 10
fontSize: 6 fontSize: 6
labelsHeight: 10 labelsHeight: 10
windowStart: zoomer.traceStart windowStart: overview.zoomer.traceStart
alignedWindowStart: zoomer.traceStart alignedWindowStart: overview.zoomer.traceStart
rangeDuration: zoomer.traceDuration rangeDuration: overview.zoomer.traceDuration
contentX: 0 contentX: 0
offsetX: 0 offsetX: 0
} }
@@ -75,35 +75,35 @@ Rectangle {
id: renderArea id: renderArea
Repeater { Repeater {
model: modelProxy.models model: overview.modelProxy.models
TimelineOverviewRenderer { TimelineOverviewRenderer {
model: modelData model: modelData
zoomer: overview.zoomer zoomer: overview.zoomer
notes: modelProxy.notes notes: overview.modelProxy.notes
width: renderArea.width width: renderArea.width
height: renderArea.height / modelProxy.models.length height: renderArea.height / overview.modelProxy.models.length
} }
} }
} }
Repeater { Repeater {
id: noteSigns 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; prev[model.modelId] = model;
return prev; return prev;
}, {}); }, {});
property int vertSpace: renderArea.height / 7 property int vertSpace: renderArea.height / 7
property color noteColor: Theme.color(Theme.Timeline_HighlightColor) 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 { Item {
property int timelineIndex: modelProxy.notes.timelineIndex(index) property int timelineIndex: overview.modelProxy.notes.timelineIndex(index)
property int timelineModel: modelProxy.notes.timelineModel(index) property int timelineModel: overview.modelProxy.notes.timelineModel(index)
property double startTime: noteSigns.modelsById[timelineModel].startTime(timelineIndex) property double startTime: noteSigns.modelsById[timelineModel].startTime(timelineIndex)
property double endTime: noteSigns.modelsById[timelineModel].endTime(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 y: timebar.height + noteSigns.vertSpace
height: noteSigns.vertSpace * 5 height: noteSigns.vertSpace * 5
width: 2 width: 2
@@ -156,7 +156,7 @@ Rectangle {
RangeMover { RangeMover {
id: rangeMover id: rangeMover
visible: modelProxy.height > 0 visible: overview.modelProxy.height > 0
onRangeLeftChanged: overview.updateZoomer() onRangeLeftChanged: overview.updateZoomer()
onRangeRightChanged: overview.updateZoomer() onRangeRightChanged: overview.updateZoomer()
} }

View File

@@ -60,9 +60,9 @@ Item {
Rectangle { Rectangle {
id: titleBar id: titleBar
width: parent.width width: parent.width
height: titleBarHeight height: rangeDetails.titleBarHeight
color: Theme.color(Theme.Timeline_PanelHeaderColor) color: Theme.color(Theme.Timeline_PanelHeaderColor)
border.width: borderWidth border.width: rangeDetails.borderWidth
border.color: Theme.color(Theme.PanelTextColorMid) border.color: Theme.color(Theme.PanelTextColorMid)
TimelineText { TimelineText {
@@ -72,8 +72,8 @@ Item {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
anchors.left: parent.left anchors.left: parent.left
anchors.right: closeIcon.left anchors.right: closeIcon.left
anchors.leftMargin: outerMargin anchors.leftMargin: rangeDetails.outerMargin
anchors.rightMargin: innerMargin anchors.rightMargin: rangeDetails.innerMargin
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
color: Theme.color(Theme.PanelTextColorLight) color: Theme.color(Theme.PanelTextColorLight)
@@ -93,11 +93,11 @@ Item {
ImageToolButton { ImageToolButton {
id: lockIcon id: lockIcon
imageSource: "image://icons/lock_" + (locked ? "closed" : "open") imageSource: "image://icons/lock_" + (rangeDetails.locked ? "closed" : "open")
anchors.top: closeIcon.top anchors.top: closeIcon.top
anchors.right: closeIcon.left anchors.right: closeIcon.left
implicitHeight: typeTitle.height implicitHeight: typeTitle.height
onClicked: locked = !locked onClicked: rangeDetails.locked = !rangeDetails.locked
ToolTip.text: qsTranslate("Tracing", "View event information on mouseover.") ToolTip.text: qsTranslate("Tracing", "View event information on mouseover.")
} }
@@ -121,7 +121,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: dragHandle.bottom anchors.bottom: dragHandle.bottom
border.width: borderWidth border.width: rangeDetails.borderWidth
border.color: Theme.color(Theme.PanelTextColorMid) border.color: Theme.color(Theme.PanelTextColorMid)
} }
@@ -130,17 +130,17 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.top: titleBar.bottom anchors.top: titleBar.bottom
anchors.topMargin: innerMargin anchors.topMargin: rangeDetails.innerMargin
anchors.leftMargin: outerMargin anchors.leftMargin: rangeDetails.outerMargin
anchors.rightMargin: outerMargin anchors.rightMargin: rangeDetails.outerMargin
spacing: innerMargin spacing: rangeDetails.innerMargin
columns: 2 columns: 2
property int minimumWidth: minimumInnerWidth property int minimumWidth: rangeDetails.minimumInnerWidth
onPositioningComplete: { onPositioningComplete: {
// max(width of longest label * 2, minimumInnerWidth) // max(width of longest label * 2, minimumInnerWidth)
var result = minimumInnerWidth; var result = rangeDetails.minimumInnerWidth;
for (var i = 0; i < children.length; ++i) { for (var i = 0; i < children.length; ++i) {
if (children[i].isLabel) if (children[i].isLabel)
result = Math.max(children[i].implicitWidth * 2 + innerMargin, result); result = Math.max(children[i].implicitWidth * 2 + innerMargin, result);
@@ -149,12 +149,14 @@ Item {
minimumWidth = result + 2 * outerMargin; minimumWidth = result + 2 * outerMargin;
} }
property int labelWidth: Math.ceil((minimumWidth - innerMargin) / 2) - outerMargin property int labelWidth: Math.ceil((minimumWidth - rangeDetails.innerMargin) / 2)
property int valueWidth: dragHandle.x - labelWidth - innerMargin - outerMargin - rangeDetails.outerMargin
property int valueWidth: dragHandle.x - labelWidth - rangeDetails.innerMargin
- rangeDetails.outerMargin
onMinimumWidthChanged: { onMinimumWidthChanged: {
if (dragHandle.x < minimumWidth - outerMargin) if (dragHandle.x < minimumWidth - rangeDetails.outerMargin)
dragHandle.x = minimumWidth - outerMargin; dragHandle.x = minimumWidth - rangeDetails.outerMargin;
} }
Repeater { Repeater {
@@ -174,9 +176,9 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: outerMargin anchors.leftMargin: rangeDetails.outerMargin
anchors.rightMargin: outerMargin anchors.rightMargin: rangeDetails.outerMargin
anchors.topMargin: visible ? innerMargin : 0 anchors.topMargin: visible ? rangeDetails.innerMargin : 0
anchors.top: col.bottom anchors.top: col.bottom
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
@@ -201,7 +203,7 @@ Item {
Timer { Timer {
id: saveTimer id: saveTimer
onTriggered: { onTriggered: {
if (!rangeDetails.readOnly) if (!noteEdit.readOnly)
rangeDetails.updateNote(noteEdit.text); rangeDetails.updateNote(noteEdit.text);
} }
interval: 1000 interval: 1000
@@ -211,15 +213,15 @@ Item {
Item { Item {
id: dragHandle id: dragHandle
width: outerMargin width: rangeDetails.outerMargin
height: outerMargin height: rangeDetails.outerMargin
x: initialWidth x: rangeDetails.initialWidth
anchors.top: noteEdit.bottom anchors.top: noteEdit.bottom
clip: true clip: true
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
drag.target: parent drag.target: parent
drag.minimumX: col.minimumWidth - outerMargin drag.minimumX: col.minimumWidth - rangeDetails.outerMargin
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
cursorShape: Qt.SizeHorCursor cursorShape: Qt.SizeHorCursor
} }

View File

@@ -30,7 +30,9 @@ Item {
return Qt.rgba(color.r, color.g, color.b, Math.max(Math.min(color.a, 0.7), 0.3)); 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 { Item {
@@ -49,7 +51,7 @@ Item {
height: parent.height height: parent.height
anchors.right: parent.left anchors.right: parent.left
width: 7 width: 7
color: handleColor color: rangeMover.handleColor
visible: false visible: false
Image { Image {
source: "image://icons/range_handle" source: "image://icons/range_handle"
@@ -72,7 +74,7 @@ Item {
anchors.fill: leftBorderHandle anchors.fill: leftBorderHandle
drag.target: leftRange drag.target: leftRange
drag.axis: "XAxis" drag.axis: Drag.XAxis
drag.minimumX: 0 drag.minimumX: 0
drag.maximumX: rangeMover.width drag.maximumX: rangeMover.width
drag.onActiveChanged: drag.maximumX = rightRange.x drag.onActiveChanged: drag.maximumX = rightRange.x
@@ -102,7 +104,7 @@ Item {
height: parent.height height: parent.height
anchors.left: parent.right anchors.left: parent.right
width: 7 width: 7
color: handleColor color: rangeMover.handleColor
visible: false visible: false
Image { Image {
source: "image://icons/range_handle" source: "image://icons/range_handle"
@@ -125,7 +127,7 @@ Item {
anchors.fill: rightBorderHandle anchors.fill: rightBorderHandle
drag.target: rightRange drag.target: rightRange
drag.axis: "XAxis" drag.axis: Drag.XAxis
drag.minimumX: 0 drag.minimumX: 0
drag.maximumX: rangeMover.width drag.maximumX: rangeMover.width
drag.onActiveChanged: drag.minimumX = leftRange.x drag.onActiveChanged: drag.minimumX = leftRange.x
@@ -150,7 +152,7 @@ Item {
anchors.fill: selectedRange anchors.fill: selectedRange
drag.target: leftRange drag.target: leftRange
drag.axis: "XAxis" drag.axis: Drag.XAxis
drag.minimumX: 0 drag.minimumX: 0
drag.maximumX: rangeMover.width - origWidth drag.maximumX: rangeMover.width - origWidth
drag.onActiveChanged: origWidth = selectedRange.width drag.onActiveChanged: origWidth = selectedRange.width

View File

@@ -42,7 +42,7 @@ Button {
onPressed: resizing = true onPressed: resizing = true
onReleased: resizing = false onReleased: resizing = false
height: dragHeight height: button.dragHeight
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View File

@@ -45,8 +45,8 @@ RangeMover {
onRangeLeftChanged: updateZoomer() onRangeLeftChanged: updateZoomer()
Connections { Connections {
target: zoomer target: selectionRange.zoomer
function onWindowChanged() { updateRange(); } function onWindowChanged() { selectionRange.updateRange(); }
} }
function setPos(pos) { function setPos(pos) {

View File

@@ -25,8 +25,8 @@ Item {
// keep inside view // keep inside view
Connections { Connections {
target: selectionRangeDetails.parent target: selectionRangeDetails.parent
function onWidthChanged() { fitInView(); } function onWidthChanged() { selectionRangeDetails.fitInView(); }
function onHeightChanged() { fitInView(); } function onHeightChanged() { selectionRangeDetails.fitInView(); }
} }
function fitInView() { function fitInView() {
@@ -79,14 +79,17 @@ Item {
id: details id: details
property var contents: [ property var contents: [
qsTranslate("Tracing", "Start") + ":", qsTranslate("Tracing", "Start") + ":",
TimeFormatter.format(startTime, referenceDuration), TimeFormatter.format(selectionRangeDetails.startTime,
selectionRangeDetails.referenceDuration),
(qsTranslate("Tracing", "End") + ":"), (qsTranslate("Tracing", "End") + ":"),
TimeFormatter.format(endTime, referenceDuration), TimeFormatter.format(selectionRangeDetails.endTime,
selectionRangeDetails.referenceDuration),
(qsTranslate("Tracing", "Duration") + ":"), (qsTranslate("Tracing", "Duration") + ":"),
TimeFormatter.format(duration, referenceDuration) TimeFormatter.format(selectionRangeDetails.duration,
selectionRangeDetails.referenceDuration)
] ]
model: showDuration ? 6 : 2 model: selectionRangeDetails.showDuration ? 6 : 2
Detail { Detail {
isLabel: index % 2 === 0 isLabel: index % 2 === 0
text: details.contents[index] text: details.contents[index]

View File

@@ -40,7 +40,8 @@ Item {
id: timeDisplayArea id: timeDisplayArea
property int firstBlock: timeDisplay.offsetX / timeDisplay.pixelsPerBlock 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 { Repeater {
id: repeater id: repeater

View File

@@ -78,11 +78,11 @@ Item {
property double maxVal: scope.model ? scope.model.rowMaxValue(index) : 0 property double maxVal: scope.model ? scope.model.rowMaxValue(index) : 0
property double valDiff: maxVal - minVal property double valDiff: maxVal - minVal
property bool scaleVisible: scope.model && scope.model.expanded && property bool scaleVisible: scope.model && scope.model.expanded &&
height > scaleMinHeight && valDiff > 0 height > timeMarks.scaleMinHeight && valDiff > 0
property double stepVal: { property double stepVal: {
var ret = 1; 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) { while (isFinite(ugly) && ugly > 1) {
ugly /= 2; ugly /= 2;
ret *= 2; ret *= 2;
@@ -122,7 +122,8 @@ Item {
anchors.bottomMargin: 2 anchors.bottomMargin: 2
anchors.leftMargin: 2 anchors.leftMargin: 2
anchors.left: parent.left anchors.left: parent.left
text: prettyPrintScale(scaleItem.minVal + index * scaleItem.stepVal) text: prettyPrintScale(scaleItem.minVal
+ index * scaleItem.stepVal)
} }
Rectangle { Rectangle {

View File

@@ -96,11 +96,11 @@ Flickable {
DelegateModel { DelegateModel {
id: timelineModel id: timelineModel
model: modelProxy.models model: flick.modelProxy.models
delegate: TimelineRenderer { delegate: TimelineRenderer {
id: renderer id: renderer
model: modelData model: modelData
notes: modelProxy.notes notes: flick.modelProxy.notes
zoomer: flick.zoomer zoomer: flick.zoomer
selectionLocked: flick.selectionLocked selectionLocked: flick.selectionLocked
x: 0 x: 0
@@ -124,29 +124,29 @@ Flickable {
} }
function recenter() { function recenter() {
if (modelData.endTime(selectedItem) < zoomer.rangeStart || if (modelData.endTime(renderer.selectedItem) < zoomer.rangeStart ||
modelData.startTime(selectedItem) > zoomer.rangeEnd) { modelData.startTime(renderer.selectedItem) > zoomer.rangeEnd) {
var newStart = Math.max((modelData.startTime(selectedItem) + var newStart = Math.max((modelData.startTime(renderer.selectedItem) +
modelData.endTime(selectedItem) - modelData.endTime(renderer.selectedItem) -
zoomer.rangeDuration) / 2, zoomer.traceStart); zoomer.rangeDuration) / 2, zoomer.traceStart);
zoomer.setRange(newStart, zoomer.setRange(newStart,
Math.min(newStart + zoomer.rangeDuration, zoomer.traceEnd)); 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 rowStart = modelData.rowOffset(row) + y;
var rowEnd = rowStart + modelData.rowHeight(row); var rowEnd = rowStart + modelData.rowHeight(row);
if (rowStart < flick.contentY || rowEnd - flick.height > flick.contentY) if (rowStart < flick.contentY || rowEnd - flick.height > flick.contentY)
flick.contentY = (rowStart + rowEnd - flick.height) / 2; flick.contentY = (rowStart + rowEnd - flick.height) / 2;
} }
onSelectedItemChanged: flick.propagateSelection(index, selectedItem); onSelectedItemChanged: flick.propagateSelection(index, renderer.selectedItem);
Connections { Connections {
target: model target: renderer.model
function onDetailsChanged() { function onDetailsChanged() {
if (selectedItem != -1) { if (renderer.selectedItem != -1) {
flick.propagateSelection(-1, -1); flick.propagateSelection(-1, -1);
flick.propagateSelection(index, selectedItem); flick.propagateSelection(index, selectedItem);
} }

View File

@@ -38,7 +38,7 @@ Flickable {
// As we cannot retrieve items by visible index we keep an array of row counts here, // 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. // 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) { function updateRowCount(visualIndex, rowCount) {
if (rowCounts[visualIndex] !== rowCount) { if (rowCounts[visualIndex] !== rowCount) {
@@ -48,7 +48,7 @@ Flickable {
} }
} }
model: modelProxy.models model: categories.modelProxy.models
delegate: Loader { delegate: Loader {
id: loader id: loader
asynchronous: y < categories.contentY + categories.height && asynchronous: y < categories.contentY + categories.height &&
@@ -73,7 +73,7 @@ Flickable {
CategoryLabel { CategoryLabel {
id: label id: label
model: modelData model: modelData
notesModel: modelProxy.notes notesModel: categories.modelProxy.notes
visualIndex: loader.visualIndex visualIndex: loader.visualIndex
dragging: categories.dragging dragging: categories.dragging
reverseSelect: categories.reverseSelect reverseSelect: categories.reverseSelect
@@ -114,7 +114,7 @@ Flickable {
TimeMarks { TimeMarks {
id: timeMarks id: timeMarks
model: modelData model: modelData
mockup: modelProxy.height === 0 mockup: categories.modelProxy.height === 0
anchors.right: parent.right anchors.right: parent.right
anchors.left: label.right anchors.left: label.right
anchors.top: parent.top anchors.top: parent.top

View File

@@ -20,7 +20,7 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: scaleHeight height: rulersParent.scaleHeight
onClicked: (mouse) => { onClicked: (mouse) => {
rulersModel.append({ rulersModel.append({
@@ -36,7 +36,8 @@ Item {
if (index >= 0) { if (index >= 0) {
rulersModel.setProperty( rulersModel.setProperty(
index, "timestamp", index, "timestamp",
(x + contentX) * viewTimePerPixel + windowStart); (x + rulersParent.contentX) * rulersParent.viewTimePerPixel
+ rulersParent.windowStart);
} }
} }
} }
@@ -46,14 +47,15 @@ Item {
Item { Item {
id: ruler id: ruler
x: (timestamp - windowStart) / viewTimePerPixel - 1 - contentX x: (timestamp - rulersParent.windowStart) / rulersParent.viewTimePerPixel
- 1 - rulersParent.contentX
y: 0 y: 0
width: 2 width: 2
height: rulersParent.height height: rulersParent.height
Rectangle { Rectangle {
id: arrow id: arrow
height: scaleHeight height: rulersParent.scaleHeight
width: scaleHeight width: rulersParent.scaleHeight
rotation: 45 rotation: 45
anchors.verticalCenter: parent.top anchors.verticalCenter: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -86,7 +88,7 @@ Item {
Rectangle { Rectangle {
anchors.top: arrow.bottom anchors.top: arrow.bottom
anchors.horizontalCenter: ruler.horizontalCenter anchors.horizontalCenter: ruler.horizontalCenter
width: scaleHeight / 4 width: rulersParent.scaleHeight / 4
height: width height: width
color: Theme.color(Theme.Timeline_PanelBackgroundColor) color: Theme.color(Theme.Timeline_PanelBackgroundColor)

View File

@@ -11,4 +11,3 @@ Text {
renderType: Text.NativeRendering renderType: Text.NativeRendering
color: Theme.color(Theme.Timeline_TextColor) color: Theme.color(Theme.Timeline_TextColor)
} }