9import QtQuick.Templates as T
10import org.kde.ksvg as KSvg
12import org.kde.plasma.core as PlasmaCore
13import org.kde.kirigami as Kirigami
14import "mobiletextselection" as MobileTextSelection
15import "private" as Private
25 property bool clearButtonShown:
false
28 readonly
property bool __hasBackgroundAndMargins: background && background.hasOwnProperty(
"margins")
31 property bool __isPassword:
false
32 onEchoModeChanged: echoMode => {
33 __isPassword |= (echoMode === TextInput.Password);
37 property bool visualFocus: activeFocus && [
39 Qt.BacktabFocusReason,
40 Qt.ShortcutFocusReason,
41 ].includes(focusReason)
51 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
52 Math.ceil(Math.max(contentWidth + leftPadding + rightPadding, placeholder.implicitWidth)))
53 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
54 Math.max(contentHeight + topPadding + bottomPadding, placeholder.implicitHeight, __isPassword ? passwordsizeholder.implicitHeight : 0))
56 topPadding: __hasBackgroundAndMargins ? background.margins.top : 0
57 leftPadding: (__hasBackgroundAndMargins ? background.margins.left : 0) + (control.effectiveHorizontalAlignment === TextInput.AlignRight ? inlineButtonRow.width : 0)
58 rightPadding: (__hasBackgroundAndMargins ? background.margins.right : 0) + (control.effectiveHorizontalAlignment === TextInput.AlignRight ? 0 : inlineButtonRow.width)
59 bottomPadding: __hasBackgroundAndMargins ? background.margins.bottom : 0
61 Kirigami.Theme.inherit: !background || !background.visible
65 selectionColor:
Kirigami.Theme.highlightColor
66 selectedTextColor:
Kirigami.Theme.highlightedTextColor
67 placeholderTextColor:
Kirigami.Theme.disabledTextColor
69 verticalAlignment: TextInput.AlignVCenter
71 horizontalAlignment: TextInput.AlignLeft
72 opacity: control.enabled ? 1 : 0.6
73 hoverEnabled: !
Kirigami.Settings.tabletMode
75 selectByMouse: !
Kirigami.Settings.tabletMode
77 cursorDelegate:
Kirigami.Settings.tabletMode ? mobileCursor : null
80 MobileTextSelection.MobileCursor {
86 MobileTextSelection.MobileTextActionsToolBar.controlRoot = control;
90 onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible =
false;
91 onPressed:
event => MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible =
true;
93 onPressAndHold:
event => {
101 MobileTextSelection.MobileCursor {
103 selectionStartHandle:
true
104 property var rect: target.positionToRectangle(target.selectionStart)
115 topPadding: control.topPadding
116 bottomPadding: control.bottomPadding
117 leftPadding: control.leftPadding
118 rightPadding: control.rightPadding
119 height: control.height
122 LayoutMirroring.enabled:
false
123 horizontalAlignment: control.effectiveHorizontalAlignment
124 verticalAlignment: control.verticalAlignment
125 elide: Text.ElideRight
126 renderType: control.renderType
127 text: control.placeholderText
128 visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !==
Qt.AlignHCenter)
129 color: control.placeholderTextColor
135 id: passwordsizeholder
138 topPadding: control.topPadding
139 bottomPadding: control.bottomPadding
140 leftPadding: control.leftPadding
141 rightPadding: control.rightPadding
143 horizontalAlignment: control.horizontalAlignment
144 verticalAlignment: control.verticalAlignment
146 renderType: control.renderType
147 text: control.passwordCharacter
153 anchors.rightMargin: control.__hasBackgroundAndMargins ? background.margins.
right : 0
154 anchors.verticalCenter: control.verticalCenter
155 LayoutMirroring.enabled: control.effectiveHorizontalAlignment === TextInput.
AlignRight
160 source: clearButtonShown ? (control.effectiveHorizontalAlignment === TextInput.
AlignRight ?
"edit-clear-locationbar-ltr" :
"edit-clear-locationbar-rtl") :
""
163 opacity: (control.length > 0 && clearButtonShown && control.enabled) ? 1 : 0
165 Behavior on opacity {
169 easing.
type: Easing.InOutQuad
174 onClicked: mouse => {
176 control.forceActiveFocus()
183 implicitWidth:
Kirigami.Units.gridUnit * 8 + margins.left + margins.right
184 implicitHeight:
Kirigami.Units.gridUnit + margins.top + margins.bottom
185 imagePath:
"widgets/lineedit"
191 leftMargin: -margins.left
192 topMargin: -margins.top
193 rightMargin: -margins.right
194 bottomMargin: -margins.bottom
196 imagePath:
"widgets/lineedit"
199 opacity: control.hovered
200 Behavior on opacity {
201 enabled: control.hovered &&
Kirigami.Units.longDuration > 0
203 duration:
Kirigami.Units.longDuration
204 easing.type: Easing.OutCubic
209 z: hasElement(
"hint-focus-over-base") ? 0 : -1
212 leftMargin: -margins.left
213 topMargin: -margins.top
214 rightMargin: -margins.right
215 bottomMargin: -margins.bottom
217 imagePath:
"widgets/lineedit"
218 prefix: control.visualFocus && hasElement(
"focusframe-center") ?
"focusframe" :
"focus"
220 opacity: control.visualFocus || control.activeFocus
221 Behavior on opacity {
222 enabled:
Kirigami.Units.longDuration > 0
224 duration:
Kirigami.Units.longDuration
225 easing.type: Easing.OutCubic
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
Type type(const QSqlDatabase &db)
QTextStream & right(QTextStream &stream)