Changeset View
Changeset View
Standalone View
Standalone View
kcm/package/contents/ui/OutputPanel.qml
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 67 | Controls.Slider { | |||
---|---|---|---|---|---|
70 | Layout.fillWidth: true | 70 | Layout.fillWidth: true | ||
71 | from: 0.5 | 71 | from: 0.5 | ||
72 | to: 3 | 72 | to: 3 | ||
73 | stepSize: 0.1 | 73 | stepSize: 0.1 | ||
74 | live: true | 74 | live: true | ||
75 | value: element.scale | 75 | value: element.scale | ||
76 | onMoved: element.scale = value | 76 | onMoved: element.scale = value | ||
77 | } | 77 | } | ||
78 | Controls.Label { | 78 | Controls.SpinBox { | ||
79 | Layout.alignment: Qt.AlignHCenter | 79 | id: spinbox | ||
80 | text: i18nc("Scale factor (e.g. 1.0x, 1.5x, 2.0x)","%1x", scaleSlider.value.toLocaleString(Qt.locale(), "f", 1)) | 80 | // Because QQC2 SpinBox doesn't natively support decimal step | ||
81 | // sizes: https://bugreports.qt.io/browse/QTBUG-67349 | ||||
82 | property real factor: 20.0 | ||||
83 | property real realValue: value / factor | ||||
84 | | ||||
85 | from : 0.5 * factor | ||||
86 | to : 3.0 * factor | ||||
87 | stepSize: 0.05 * factor | ||||
88 | value: element.scale * factor | ||||
89 | validator: DoubleValidator { | ||||
90 | bottom: Math.min(spinbox.from, spinbox.to) * spinbox.factor | ||||
romangg: whitespace around multiplication, next line as well | |||||
91 | top: Math.max(spinbox.from, spinbox.to) * spinbox.factor | ||||
92 | } | ||||
93 | textFromValue: function(value, locale) { | ||||
94 | return parseFloat(value * 1.0 / factor).toFixed(2); | ||||
95 | } | ||||
96 | valueFromText: function(text, locale) { | ||||
97 | return Number.fromLocaleString(locale, text) * factor | ||||
98 | } | ||||
99 | onValueModified: element.scale = realValue | ||||
81 | } | 100 | } | ||
82 | } | 101 | } | ||
83 | 102 | | |||
84 | Controls.ButtonGroup { | 103 | Controls.ButtonGroup { | ||
85 | buttons: orientation.children | 104 | buttons: orientation.children | ||
86 | } | 105 | } | ||
87 | 106 | | |||
88 | RowLayout { | 107 | RowLayout { | ||
Show All 38 Lines |
whitespace around multiplication, next line as well