mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 08:47:50 -06:00
Fix code style.
Contributes to CURA-5725.
This commit is contained in:
parent
f965b66c87
commit
0ef46feeae
2 changed files with 105 additions and 59 deletions
|
@ -9,7 +9,8 @@ import QtQuick.Controls.Styles 1.1
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
id: sliderRoot
|
id: sliderRoot
|
||||||
|
|
||||||
// handle properties
|
// handle properties
|
||||||
|
@ -41,39 +42,47 @@ Item {
|
||||||
property bool layersVisible: true
|
property bool layersVisible: true
|
||||||
property bool manuallyChanged: true // Indicates whether the value was changed manually or during simulation
|
property bool manuallyChanged: true // Indicates whether the value was changed manually or during simulation
|
||||||
|
|
||||||
function getUpperValueFromSliderHandle() {
|
function getUpperValueFromSliderHandle()
|
||||||
|
{
|
||||||
return upperHandle.getValue()
|
return upperHandle.getValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUpperValue(value) {
|
function setUpperValue(value)
|
||||||
|
{
|
||||||
upperHandle.setValue(value)
|
upperHandle.setValue(value)
|
||||||
updateRangeHandle()
|
updateRangeHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLowerValueFromSliderHandle() {
|
function getLowerValueFromSliderHandle()
|
||||||
|
{
|
||||||
return lowerHandle.getValue()
|
return lowerHandle.getValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLowerValue(value) {
|
function setLowerValue(value)
|
||||||
|
{
|
||||||
lowerHandle.setValue(value)
|
lowerHandle.setValue(value)
|
||||||
updateRangeHandle()
|
updateRangeHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRangeHandle() {
|
function updateRangeHandle()
|
||||||
|
{
|
||||||
rangeHandle.height = lowerHandle.y - (upperHandle.y + upperHandle.height)
|
rangeHandle.height = lowerHandle.y - (upperHandle.y + upperHandle.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the active handle to show only one label at a time
|
// set the active handle to show only one label at a time
|
||||||
function setActiveHandle(handle) {
|
function setActiveHandle(handle)
|
||||||
|
{
|
||||||
activeHandle = handle
|
activeHandle = handle
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeValue(value) {
|
function normalizeValue(value)
|
||||||
|
{
|
||||||
return Math.min(Math.max(value, sliderRoot.minimumValue), sliderRoot.maximumValue)
|
return Math.min(Math.max(value, sliderRoot.minimumValue), sliderRoot.maximumValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// slider track
|
// slider track
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: track
|
id: track
|
||||||
|
|
||||||
width: sliderRoot.trackThickness
|
width: sliderRoot.trackThickness
|
||||||
|
@ -87,7 +96,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Range handle
|
// Range handle
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
id: rangeHandle
|
id: rangeHandle
|
||||||
|
|
||||||
y: upperHandle.y + upperHandle.height
|
y: upperHandle.y + upperHandle.height
|
||||||
|
@ -97,7 +107,8 @@ Item {
|
||||||
visible: sliderRoot.layersVisible
|
visible: sliderRoot.layersVisible
|
||||||
|
|
||||||
// set the new value when dragging
|
// set the new value when dragging
|
||||||
function onHandleDragged() {
|
function onHandleDragged()
|
||||||
|
{
|
||||||
sliderRoot.manuallyChanged = true
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
upperHandle.y = y - upperHandle.height
|
upperHandle.y = y - upperHandle.height
|
||||||
|
@ -117,7 +128,8 @@ Item {
|
||||||
upperHandle.setValue(value)
|
upperHandle.setValue(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue(value) {
|
function setValue(value)
|
||||||
|
{
|
||||||
var range = sliderRoot.upperValue - sliderRoot.lowerValue
|
var range = sliderRoot.upperValue - sliderRoot.lowerValue
|
||||||
value = Math.min(value, sliderRoot.maximumValue)
|
value = Math.min(value, sliderRoot.maximumValue)
|
||||||
value = Math.max(value, sliderRoot.minimumValue + range)
|
value = Math.max(value, sliderRoot.minimumValue + range)
|
||||||
|
@ -126,17 +138,20 @@ Item {
|
||||||
UM.SimulationView.setMinimumLayer(value - range)
|
UM.SimulationView.setMinimumLayer(value - range)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
width: sliderRoot.trackThickness - 2 * sliderRoot.trackBorderWidth
|
width: sliderRoot.trackThickness - 2 * sliderRoot.trackBorderWidth
|
||||||
height: parent.height + sliderRoot.handleSize
|
height: parent.height + sliderRoot.handleSize
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: sliderRoot.rangeHandleColor
|
color: sliderRoot.rangeHandleColor
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea
|
||||||
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
drag {
|
drag
|
||||||
|
{
|
||||||
target: parent
|
target: parent
|
||||||
axis: Drag.YAxis
|
axis: Drag.YAxis
|
||||||
minimumY: upperHandle.height
|
minimumY: upperHandle.height
|
||||||
|
@ -147,7 +162,8 @@ Item {
|
||||||
onPressed: sliderRoot.setActiveHandle(rangeHandle)
|
onPressed: sliderRoot.setActiveHandle(rangeHandle)
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulationSliderLabel {
|
SimulationSliderLabel
|
||||||
|
{
|
||||||
id: rangleHandleLabel
|
id: rangleHandleLabel
|
||||||
|
|
||||||
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
||||||
|
@ -165,7 +181,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upper handle
|
// Upper handle
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: upperHandle
|
id: upperHandle
|
||||||
|
|
||||||
y: sliderRoot.height - (sliderRoot.minimumRangeHandleSize + 2 * sliderRoot.handleSize)
|
y: sliderRoot.height - (sliderRoot.minimumRangeHandleSize + 2 * sliderRoot.handleSize)
|
||||||
|
@ -176,11 +193,13 @@ Item {
|
||||||
color: upperHandleLabel.activeFocus ? sliderRoot.handleActiveColor : sliderRoot.upperHandleColor
|
color: upperHandleLabel.activeFocus ? sliderRoot.handleActiveColor : sliderRoot.upperHandleColor
|
||||||
visible: sliderRoot.layersVisible
|
visible: sliderRoot.layersVisible
|
||||||
|
|
||||||
function onHandleDragged() {
|
function onHandleDragged()
|
||||||
|
{
|
||||||
sliderRoot.manuallyChanged = true
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
// don't allow the lower handle to be heigher than the upper handle
|
// don't allow the lower handle to be heigher than the upper handle
|
||||||
if (lowerHandle.y - (y + height) < sliderRoot.minimumRangeHandleSize) {
|
if (lowerHandle.y - (y + height) < sliderRoot.minimumRangeHandleSize)
|
||||||
|
{
|
||||||
lowerHandle.y = y + height + sliderRoot.minimumRangeHandleSize
|
lowerHandle.y = y + height + sliderRoot.minimumRangeHandleSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +211,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the upper value based on the slider position
|
// get the upper value based on the slider position
|
||||||
function getValue() {
|
function getValue()
|
||||||
|
{
|
||||||
var result = y / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize))
|
var result = y / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize))
|
||||||
result = sliderRoot.maximumValue + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumValue))
|
result = sliderRoot.maximumValue + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumValue))
|
||||||
result = sliderRoot.roundValues ? Math.round(result) : result
|
result = sliderRoot.roundValues ? Math.round(result) : result
|
||||||
|
@ -206,7 +226,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the slider position based on the upper value
|
// set the slider position based on the upper value
|
||||||
function setValue(value) {
|
function setValue(value)
|
||||||
|
{
|
||||||
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
||||||
value = sliderRoot.normalizeValue(value)
|
value = sliderRoot.normalizeValue(value)
|
||||||
|
|
||||||
|
@ -220,14 +241,16 @@ Item {
|
||||||
sliderRoot.updateRangeHandle()
|
sliderRoot.updateRangeHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onUpPressed: upperHandleLabel.setValue(upperHandleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
Keys.onUpPressed: upperHandleLabel.setValueManually(upperHandleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
Keys.onDownPressed: upperHandleLabel.setValue(upperHandleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
Keys.onDownPressed: upperHandleLabel.setValueManually(upperHandleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
|
|
||||||
// dragging
|
// dragging
|
||||||
MouseArea {
|
MouseArea
|
||||||
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
drag {
|
drag
|
||||||
|
{
|
||||||
target: parent
|
target: parent
|
||||||
axis: Drag.YAxis
|
axis: Drag.YAxis
|
||||||
minimumY: 0
|
minimumY: 0
|
||||||
|
@ -235,13 +258,15 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPositionChanged: parent.onHandleDragged()
|
onPositionChanged: parent.onHandleDragged()
|
||||||
onPressed: {
|
onPressed:
|
||||||
|
{
|
||||||
sliderRoot.setActiveHandle(upperHandle)
|
sliderRoot.setActiveHandle(upperHandle)
|
||||||
upperHandleLabel.forceActiveFocus()
|
upperHandleLabel.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulationSliderLabel {
|
SimulationSliderLabel
|
||||||
|
{
|
||||||
id: upperHandleLabel
|
id: upperHandleLabel
|
||||||
|
|
||||||
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
||||||
|
@ -259,7 +284,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lower handle
|
// Lower handle
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: lowerHandle
|
id: lowerHandle
|
||||||
|
|
||||||
y: sliderRoot.height - sliderRoot.handleSize
|
y: sliderRoot.height - sliderRoot.handleSize
|
||||||
|
@ -271,11 +297,13 @@ Item {
|
||||||
|
|
||||||
visible: sliderRoot.layersVisible
|
visible: sliderRoot.layersVisible
|
||||||
|
|
||||||
function onHandleDragged() {
|
function onHandleDragged()
|
||||||
|
{
|
||||||
sliderRoot.manuallyChanged = true
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
// don't allow the upper handle to be lower than the lower handle
|
// don't allow the upper handle to be lower than the lower handle
|
||||||
if (y - (upperHandle.y + upperHandle.height) < sliderRoot.minimumRangeHandleSize) {
|
if (y - (upperHandle.y + upperHandle.height) < sliderRoot.minimumRangeHandleSize)
|
||||||
|
{
|
||||||
upperHandle.y = y - (upperHandle.heigth + sliderRoot.minimumRangeHandleSize)
|
upperHandle.y = y - (upperHandle.heigth + sliderRoot.minimumRangeHandleSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,21 +315,23 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the lower value from the current slider position
|
// get the lower value from the current slider position
|
||||||
function getValue() {
|
function getValue()
|
||||||
|
{
|
||||||
var result = (y - (sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize)) / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize));
|
var result = (y - (sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize)) / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize));
|
||||||
result = sliderRoot.maximumValue - sliderRoot.minimumRange + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumRange))
|
result = sliderRoot.maximumValue - sliderRoot.minimumRange + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumRange))
|
||||||
result = sliderRoot.roundValues ? Math.round(result) : result
|
result = sliderRoot.roundValues ? Math.round(result) : result
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValueManually(value)
|
function setValueManually(handle, value)
|
||||||
{
|
{
|
||||||
sliderRoot.manuallyChanged = true
|
sliderRoot.manuallyChanged = true
|
||||||
lowerHandle.setValue(value)
|
handle.setValue(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the slider position based on the lower value
|
// set the slider position based on the lower value
|
||||||
function setValue(value) {
|
function setValue(value)
|
||||||
|
{
|
||||||
|
|
||||||
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
||||||
value = sliderRoot.normalizeValue(value)
|
value = sliderRoot.normalizeValue(value)
|
||||||
|
@ -320,10 +350,12 @@ Item {
|
||||||
Keys.onDownPressed: lowerHandleLabel.setValue(lowerHandleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
Keys.onDownPressed: lowerHandleLabel.setValue(lowerHandleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
|
|
||||||
// dragging
|
// dragging
|
||||||
MouseArea {
|
MouseArea
|
||||||
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
drag {
|
drag
|
||||||
|
{
|
||||||
target: parent
|
target: parent
|
||||||
axis: Drag.YAxis
|
axis: Drag.YAxis
|
||||||
minimumY: upperHandle.height + sliderRoot.minimumRangeHandleSize
|
minimumY: upperHandle.height + sliderRoot.minimumRangeHandleSize
|
||||||
|
@ -331,13 +363,15 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPositionChanged: parent.onHandleDragged()
|
onPositionChanged: parent.onHandleDragged()
|
||||||
onPressed: {
|
onPressed:
|
||||||
|
{
|
||||||
sliderRoot.setActiveHandle(lowerHandle)
|
sliderRoot.setActiveHandle(lowerHandle)
|
||||||
lowerHandleLabel.forceActiveFocus()
|
lowerHandleLabel.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulationSliderLabel {
|
SimulationSliderLabel
|
||||||
|
{
|
||||||
id: lowerHandleLabel
|
id: lowerHandleLabel
|
||||||
|
|
||||||
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
||||||
|
|
|
@ -9,7 +9,8 @@ import QtQuick.Controls.Styles 1.1
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
id: sliderRoot
|
id: sliderRoot
|
||||||
|
|
||||||
// handle properties
|
// handle properties
|
||||||
|
@ -36,25 +37,30 @@ Item {
|
||||||
property bool pathsVisible: true
|
property bool pathsVisible: true
|
||||||
property bool manuallyChanged: true // Indicates whether the value was changed manually or during simulation
|
property bool manuallyChanged: true // Indicates whether the value was changed manually or during simulation
|
||||||
|
|
||||||
function getHandleValueFromSliderHandle() {
|
function getHandleValueFromSliderHandle()
|
||||||
|
{
|
||||||
return handle.getValue()
|
return handle.getValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHandleValue(value) {
|
function setHandleValue(value
|
||||||
|
{
|
||||||
handle.setValue(value)
|
handle.setValue(value)
|
||||||
updateRangeHandle()
|
updateRangeHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRangeHandle() {
|
function updateRangeHandle()
|
||||||
|
{
|
||||||
rangeHandle.width = handle.x - sliderRoot.handleSize
|
rangeHandle.width = handle.x - sliderRoot.handleSize
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeValue(value) {
|
function normalizeValue(value)
|
||||||
|
{
|
||||||
return Math.min(Math.max(value, sliderRoot.minimumValue), sliderRoot.maximumValue)
|
return Math.min(Math.max(value, sliderRoot.minimumValue), sliderRoot.maximumValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// slider track
|
// slider track
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: track
|
id: track
|
||||||
|
|
||||||
width: sliderRoot.width - sliderRoot.handleSize
|
width: sliderRoot.width - sliderRoot.handleSize
|
||||||
|
@ -68,7 +74,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Progress indicator
|
// Progress indicator
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
id: rangeHandle
|
id: rangeHandle
|
||||||
|
|
||||||
x: handle.width
|
x: handle.width
|
||||||
|
@ -77,7 +84,8 @@ Item {
|
||||||
anchors.verticalCenter: sliderRoot.verticalCenter
|
anchors.verticalCenter: sliderRoot.verticalCenter
|
||||||
visible: sliderRoot.pathsVisible
|
visible: sliderRoot.pathsVisible
|
||||||
|
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
height: sliderRoot.trackThickness - 2 * sliderRoot.trackBorderWidth
|
height: sliderRoot.trackThickness - 2 * sliderRoot.trackBorderWidth
|
||||||
width: parent.width + sliderRoot.handleSize
|
width: parent.width + sliderRoot.handleSize
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
@ -86,7 +94,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle
|
// Handle
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: handle
|
id: handle
|
||||||
|
|
||||||
x: sliderRoot.handleSize
|
x: sliderRoot.handleSize
|
||||||
|
@ -97,7 +106,8 @@ Item {
|
||||||
color: handleLabel.activeFocus ? sliderRoot.handleActiveColor : sliderRoot.handleColor
|
color: handleLabel.activeFocus ? sliderRoot.handleActiveColor : sliderRoot.handleColor
|
||||||
visible: sliderRoot.pathsVisible
|
visible: sliderRoot.pathsVisible
|
||||||
|
|
||||||
function onHandleDragged() {
|
function onHandleDragged()
|
||||||
|
{
|
||||||
sliderRoot.manuallyChanged = true
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
// update the range handle
|
// update the range handle
|
||||||
|
@ -108,7 +118,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the value based on the slider position
|
// get the value based on the slider position
|
||||||
function getValue() {
|
function getValue()
|
||||||
|
{
|
||||||
var result = x / (sliderRoot.width - sliderRoot.handleSize)
|
var result = x / (sliderRoot.width - sliderRoot.handleSize)
|
||||||
result = result * sliderRoot.maximumValue
|
result = result * sliderRoot.maximumValue
|
||||||
result = sliderRoot.roundValues ? Math.round(result) : result
|
result = sliderRoot.roundValues ? Math.round(result) : result
|
||||||
|
@ -122,7 +133,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the slider position based on the value
|
// set the slider position based on the value
|
||||||
function setValue(value) {
|
function setValue(value)
|
||||||
|
{
|
||||||
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
||||||
value = sliderRoot.normalizeValue(value)
|
value = sliderRoot.normalizeValue(value)
|
||||||
|
|
||||||
|
@ -136,27 +148,27 @@ Item {
|
||||||
sliderRoot.updateRangeHandle()
|
sliderRoot.updateRangeHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onRightPressed: handleLabel.setValue(handleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
Keys.onRightPressed: handleLabel.setValueManually(handleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
Keys.onLeftPressed: handleLabel.setValue(handleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
Keys.onLeftPressed: handleLabel.setValueManually(handleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
|
|
||||||
// dragging
|
// dragging
|
||||||
MouseArea {
|
MouseArea
|
||||||
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
drag {
|
drag
|
||||||
|
{
|
||||||
target: parent
|
target: parent
|
||||||
axis: Drag.XAxis
|
axis: Drag.XAxis
|
||||||
minimumX: 0
|
minimumX: 0
|
||||||
maximumX: sliderRoot.width - sliderRoot.handleSize
|
maximumX: sliderRoot.width - sliderRoot.handleSize
|
||||||
}
|
}
|
||||||
onPressed: {
|
onPressed: handleLabel.forceActiveFocus()
|
||||||
handleLabel.forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
onPositionChanged: parent.onHandleDragged()
|
onPositionChanged: parent.onHandleDragged()
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulationSliderLabel {
|
SimulationSliderLabel
|
||||||
|
{
|
||||||
id: handleLabel
|
id: handleLabel
|
||||||
|
|
||||||
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue