9import QtQuick.Templates as T
10import org.kde.ksvg as KSvg
12import org.kde.plasma.core as PlasmaCore
13import org.kde.plasma.components as PlasmaComponents3
14import org.kde.kirigami as Kirigami
20 implicitWidth: Math.max(
21 implicitBackgroundWidth + leftInset + rightInset,
22 Math.max(implicitContentWidth,
Kirigami.Units.gridUnit)
23 + spacing * 2 + leftPadding + rightPadding,
24 up.implicitIndicatorWidth + down.implicitIndicatorWidth
26 implicitHeight: Math.max(
27 implicitBackgroundHeight + topInset + bottomInset,
28 implicitContentHeight + topPadding + bottomPadding,
29 up.implicitIndicatorHeight,
30 down.implicitIndicatorHeight
33 leftPadding: !mirrored ? down.implicitIndicatorWidth : up.implicitIndicatorWidth
34 rightPadding: mirrored ? down.implicitIndicatorWidth : up.implicitIndicatorWidth
35 topPadding: bgLoader.topMargin
36 bottomPadding: bgLoader.bottomMargin
37 spacing: bgLoader.leftMargin
39 inputMethodHints:
Qt.ImhFormattedNumbersOnly
40 validator: IntValidator {
41 locale: control.locale.name
42 bottom: Math.min(control.from, control.to)
43 top: Math.max(control.from, control.to)
46 hoverEnabled:
Qt.styleHints.useHoverEffects
50 imagePath:
"widgets/line"
53 up.indicator: P.FlatButtonBackground {
54 x: control.mirrored ? 0 : parent.width - width
55 implicitHeight:
Kirigami.Units.gridUnit + bgLoader.topMargin + bgLoader.bottomMargin
56 implicitWidth:
Kirigami.Units.gridUnit + bgLoader.leftMargin + bgLoader.rightMargin
58 hovered: control.up.hovered
59 pressed: control.up.pressed
63 anchors.centerIn: parent
64 implicitWidth:
Kirigami.Units.iconSizes.sizeForLabels
65 implicitHeight:
Kirigami.Units.iconSizes.sizeForLabels
66 source:
"value-increase"
70 x: control.mirrored ? parent.width - width : 0
75 topMargin: bgLoader.topMargin
76 bottomMargin: bgLoader.bottomMargin
78 implicitWidth: naturalSize.width
79 implicitHeight: implicitWidth
80 elementId:
"vertical-line"
85 down.indicator: P.FlatButtonBackground {
86 x: control.mirrored ? parent.width - width : 0
87 implicitHeight:
Kirigami.Units.gridUnit + bgLoader.topMargin + bgLoader.bottomMargin
88 implicitWidth:
Kirigami.Units.gridUnit + bgLoader.leftMargin + bgLoader.rightMargin
90 hovered: control.down.hovered
91 pressed: control.down.pressed
95 anchors.centerIn: parent
96 implicitWidth:
Kirigami.Units.iconSizes.sizeForLabels
97 implicitHeight:
Kirigami.Units.iconSizes.sizeForLabels
98 source:
"value-decrease"
99 fallback:
"list-remove"
102 x: control.mirrored ? 0 : parent.width - width
106 bottom: parent.bottom
107 topMargin: bgLoader.topMargin
108 bottomMargin: bgLoader.bottomMargin
110 implicitWidth: naturalSize.width
111 implicitHeight: implicitWidth
112 elementId:
"vertical-line"
117 contentItem: T.TextField {
119 opacity: enabled ? 1 : 0.5
120 implicitWidth: Math.ceil(contentWidth) + leftPadding + rightPadding
121 implicitHeight: Math.ceil(contentHeight) + topPadding + bottomPadding
122 text: control.displayText
127 selectionColor:
Kirigami.Theme.highlightColor
128 selectedTextColor:
Kirigami.Theme.highlightedTextColor
129 horizontalAlignment:
Qt.AlignHCenter
130 verticalAlignment:
Qt.AlignVCenter
131 readOnly: !control.editable
132 validator: control.validator
133 inputMethodHints: control.inputMethodHints
143 topMargin: control.topInset
145 leftMargin: LayoutMirroring.enabled ? control.rightInset : control.leftInset
146 rightMargin: LayoutMirroring.enabled ? control.leftInset : control.rightInset
147 bottomMargin: control.bottomInset
149 readonly
property real leftMargin: item.leftMargin
150 readonly
property real rightMargin: item.rightMargin
151 readonly
property real topMargin: item.topMargin
152 readonly
property real bottomMargin: item.bottomMargin
153 sourceComponent: control.editable ? editableBg : noneditableBg
156 P.RaisedButtonBackground {
157 hovered: control.hovered
158 focused: control.visualFocus || (control.contentItem.activeFocus && (
159 control.contentItem.focusReason ==
Qt.TabFocusReason ||
160 control.contentItem.focusReason ==
Qt.BacktabFocusReason ||
161 control.contentItem.focusReason ==
Qt.ShortcutFocusReason
170 readonly
property real leftMargin: margins.left
171 readonly
property real rightMargin: margins.right
172 readonly
property real topMargin: margins.top
173 readonly
property real bottomMargin: margins.bottom
174 imagePath:
"widgets/lineedit"
179 leftMargin: -margins.left
180 topMargin: -margins.top
181 rightMargin: -margins.right
182 bottomMargin: -margins.bottom
184 imagePath:
"widgets/lineedit"
187 opacity: control.hovered
188 Behavior on opacity {
189 enabled: control.hovered &&
Kirigami.Units.longDuration > 0
191 duration:
Kirigami.Units.longDuration
192 easing.type: Easing.OutCubic
197 property bool visualFocus: control.visualFocus || (control.contentItem.activeFocus
198 && (control.contentItem.focusReason ==
Qt.TabFocusReason ||
199 control.contentItem.focusReason ==
Qt.BacktabFocusReason ||
200 control.contentItem.focusReason ==
Qt.ShortcutFocusReason)
202 z: lineEditSvg.hasElement(
"hint-focus-over-base") ? 0 : -1
205 leftMargin: -margins.left
206 topMargin: -margins.top
207 rightMargin: -margins.right
208 bottomMargin: -margins.bottom
210 imagePath:
"widgets/lineedit"
211 prefix: visualFocus && lineEditSvg.hasElement(
"focusframe-center") ?
"focusframe" :
"focus"
213 opacity: visualFocus || control.activeFocus || control.contentItem.activeFocus
214 Behavior on opacity {
215 enabled:
Kirigami.Units.longDuration > 0
217 duration:
Kirigami.Units.longDuration
218 easing.type: Easing.OutCubic
224 imagePath:
"widgets/lineedit"