21 import org.kde.plasma.core 0.1 as PlasmaCore
22 import "private" as Private
38 property bool errorHighlight:
false
47 property string placeholderText
55 property alias inputMethodHints: textInput.inputMethodHints
63 property alias font: textInput.font
69 property alias cursorPosition: textInput.cursorPosition
77 property alias readOnly: textInput.readOnly
93 property alias echoMode: textInput.echoMode
96 property alias passwordCharacter: textInput.passwordCharacter
97 property alias acceptableInput: textInput.acceptableInput
108 property alias inputMask: textInput.inputMask
132 property alias validator: textInput.validator
140 property alias selectedText: textInput.selectedText
148 property alias selectionEnd: textInput.selectionEnd
156 property alias selectionStart: textInput.selectionStart
162 property alias text: textInput.text
172 property alias maximumLength: textInput.maximumLength
183 property
bool clearButtonShown: false
218 function select(start, end) {
219 textInput.select(start, end);
225 function selectAll() {
226 textInput.selectAll();
232 function selectWord() {
233 textInput.selectWord();
249 function positionAt(pos) {
250 return textInput.positionAt(pos);
262 function positionToRectangle(pos) {
263 return textInput.positionToRectangle(pos);
268 function forceActiveFocus() {
269 textInput.forceActiveFocus();
273 property alias activeFocus: textInput.activeFocus
276 implicitWidth: theme.defaultFont.mSize.width*12 + base.internalPadding*2
277 implicitHeight: theme.defaultFont.mSize.height + base.internalPadding*2
280 opacity: enabled ? 1.0 : 0.5
282 Private.TextFieldFocus {
284 state: textInput.activeFocus ?
"focus" : (mouseWatcher.containsMouse ?
"hover" :
"hidden")
288 PlasmaCore.FrameSvgItem {
293 imagePath:
"widgets/lineedit"
295 property real internalPadding: theme.defaultFont.mSize.height*0.3
306 textInput.forceActiveFocus();
314 verticalCenter: parent.verticalCenter
315 leftMargin: base.margins.left + base.internalPadding
316 rightMargin: base.margins.right + base.internalPadding
318 text: placeholderText
319 visible: textInput.text ==
""
321 color: theme.buttonTextColor
323 elide: Text.ElideRight
325 font.capitalization: theme.defaultFont.capitalization
326 font.family: theme.defaultFont.family
327 font.italic: theme.defaultFont.italic
328 font.letterSpacing: theme.defaultFont.letterSpacing
329 font.pointSize: theme.defaultFont.pointSize
330 font.strikeout: theme.defaultFont.strikeout
331 font.underline: theme.defaultFont.underline
332 font.weight: theme.defaultFont.weight
333 font.wordSpacing: theme.defaultFont.wordSpacing
342 verticalCenter: parent.verticalCenter
344 leftMargin: base.margins.left + base.internalPadding
345 rightMargin: base.margins.right + (clearButton.opacity > 0 ? clearButton.width : 0) + base.internalPadding
347 passwordCharacter:
"•"
349 color: theme.buttonTextColor
350 enabled: textField.enabled
353 onActiveFocusChanged: {
354 if (!textField.activeFocus) {
355 textInput.closeSoftwareInputPanel()
358 onAccepted: textField.accepted()
359 Keys.forwardTo: textField
362 PlasmaCore.IconItem {
364 source:
"edit-clear-locationbar-rtl"
365 height: Math.max(textInput.height, theme.smallIconSize)
367 opacity: (textInput.text !=
"" && clearButtonShown) ? 1 : 0
368 Behavior on opacity {
371 easing.type: Easing.InOutQuad
377 verticalCenter: textInput.verticalCenter
383 textInput.forceActiveFocus()