Implemented selection on 3d devices view

This commit is contained in:
2023-02-22 11:35:44 +01:00
parent 34ce21f7de
commit 27ea0fd98c
3 changed files with 41 additions and 25 deletions

View File

@ -11,20 +11,22 @@ Item {
property int previousMouseY: -1 property int previousMouseY: -1
property alias model: itemModelScatterDataProxy.itemModel property alias model: itemModelScatterDataProxy.itemModel
ThemeColor { property alias selectedItem: scatterSeries.selectedItem
id: dynamicColor
ColorAnimation on color { // ThemeColor {
from: "red" // id: dynamicColor
to: "yellow" // ColorAnimation on color {
duration: 2000 // from: "red"
loops: Animation.Infinite // to: "yellow"
} // duration: 2000
} // loops: Animation.Infinite
// }
// }
Theme3D { Theme3D {
id: dynamicColorTheme id: dynamicColorTheme
type: Theme3D.ThemeEbony type: Theme3D.ThemeEbony
baseColors: [dynamicColor] // baseColors: [dynamicColor]
font.pointSize: 50 font.pointSize: 50
labelBorderEnabled: true labelBorderEnabled: true
labelBackgroundColor: "gold" labelBackgroundColor: "gold"
@ -50,10 +52,9 @@ Item {
Scatter3D { Scatter3D {
id: scatterGraph id: scatterGraph
inputHandler: null inputHandler: null
//! [0]
width: dataView.width width: dataView.width
height: dataView.height height: dataView.height
theme: dynamicColorTheme theme: isabelleTheme
shadowQuality: AbstractGraph3D.ShadowQualityLow shadowQuality: AbstractGraph3D.ShadowQualityLow
scene.activeCamera.yRotation: 45.0 scene.activeCamera.yRotation: 45.0
scene.activeCamera.xRotation: 45.0 scene.activeCamera.xRotation: 45.0
@ -79,11 +80,21 @@ Item {
} }
} }
onSelectedElementChanged: { onSelectedElementChanged: {
if (selectedElement >= AbstractGraph3D.ElementAxisXLabel switch (selectedElement) {
&& selectedElement <= AbstractGraph3D.ElementAxisZLabel) case Scatter3D.ElementSeries:
selectedAxisLabel = selectedElement // console.log('series');
else break;
selectedAxisLabel = -1 case Scatter3D.ElementAxisXLabel:
case Scatter3D.ElementAxisYLabel:
case Scatter3D.ElementAxisZLabel:
// console.log('axis');
if (selectedElement >= AbstractGraph3D.ElementAxisXLabel
&& selectedElement <= AbstractGraph3D.ElementAxisZLabel)
selectedAxisLabel = selectedElement
else
selectedAxisLabel = -1
break;
}
} }
} }
@ -179,18 +190,18 @@ Item {
onClicked: { onClicked: {
if (autoRange) { if (autoRange) {
text = "Use Automatic Range" text = "Use Automatic Range"
scatterGraph.axisX.min = 0.3 scatterGraph.axisX.min = -10
scatterGraph.axisX.max = 0.7 scatterGraph.axisX.max = 10
scatterGraph.axisY.min = 0.3 scatterGraph.axisY.min = -10
scatterGraph.axisY.max = 0.7 scatterGraph.axisY.max = 10
scatterGraph.axisZ.min = 0.3 scatterGraph.axisZ.min = -10
scatterGraph.axisZ.max = 0.7 scatterGraph.axisZ.max = 10
autoRange = false autoRange = false
dragSpeedModifier = 200.0 dragSpeedModifier = 25.0
} else { } else {
text = "Use Preset Range" text = "Use Preset Range"
autoRange = true autoRange = true
dragSpeedModifier = 100.0 dragSpeedModifier = 25.0
} }
scatterGraph.axisX.autoAdjustRange = autoRange scatterGraph.axisX.autoAdjustRange = autoRange
scatterGraph.axisY.autoAdjustRange = autoRange scatterGraph.axisY.autoAdjustRange = autoRange

View File

@ -117,10 +117,14 @@ ColumnLayout {
} }
Devices3dView { Devices3dView {
id: devices3dView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
model: model model: model
selectedItem: listView.currentIndex
onSelectedItemChanged: if (selectedItem != -1) listView.currentIndex = selectedItem;
} }
} }
} }

View File

@ -45,6 +45,7 @@ ColumnLayout {
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
highlightRangeMode: ListView.StrictlyEnforceRange
onCountChanged: if (count === 0 && currentIndex >= 0) currentIndex = -1 onCountChanged: if (count === 0 && currentIndex >= 0) currentIndex = -1