ActionTextField QML Type

This is advanced textfield. It is recommended to use this class when there is a need to create a create a textfield with action buttons (e.g a clear action). More...

Import Statement: import org.kde.plasma.extras
Inherits:

TextField

Inherited By:

PasswordField and SearchField

Properties

Detailed Description

For common pattern like, a search field or a password field, prefer using the more specific SearchField or PasswordField.

Example usage for a search field:

 import QtQuick.Controls as QQC2
 import org.kde.plasma.extras as PlasmaExtras

 PlasmaExtras.ActionTextField {
     id: searchField

     placeholderText: "Search…"

     focusSequence: StandardKey.Find

     rightActions: [
         QQC2.Action {
             icon.name: "edit-clear"
             enabled: searchField.text !== ""
             onTriggered: {
                 searchField.clear()
                 searchField.accepted()
             }
         }
     ]

     onAccepted: console.log("Search text is " + searchField.text)
 }

Property Documentation

focusSequence : keysequence

This property holds a shortcut sequence that will focus the text field.

focusSequences : keysequence [since 6.7]

This property holds multiple shortcut sequences that will focus the text field.

By default no shortcut is set.

This property was introduced in 6.7.

leftActions : list<T.Action>

This property holds a list of actions that will be displayed on the left side of the text field.

By default this list is empty.

rightActions : list<T.Action>

This property holds a list of actions that will be displayed on the right side of the text field.

By default this list is empty.