Qt Reference Documentation

QML SearchBox Element

Provides a common look and feel for inputting a search string. More...

This element was introduced in Qt Quick Components 1.1.

Properties

Signal Handlers

Detailed Description

A SearchBox enables users to find contents in a view and see the results. SearchBox implements a progressive search method where resulting matches are displayed incrementally as the user enters text in the search term input field.

 // Search box without backbutton
 SearchBox {
     id: searchbox
     placeHolderText: "Search Text"
     onSearchTextChanged: { ... }    // Get the current search text and do search operation.
 }

 // Search box with backbutton
 SearchBox {
     id: searchbox
     backButton: true
     placeHolderText: "Search Text"
     onSearchTextChanged: { ... }
     onBackClicked: { ... }
 }

Property Documentation

backButton : bool

Enables the back button from the searchbox. It should only be used if searchbox is not displayed in the original application view. Clicking the back button dismisses the search view and returns to the original view. Property default is false.


maximumLength : int

The maximum permitted length of the text in the searchbox's text input field. If the text is too long, it is truncated at the limit. By default, this property contains a value of 32767. Shares the same values as those defined for TextInput's maximumLength property.


placeHolderText : string

The text that is shown in the searchbox's text input field. This text is shown as long as the text input field does not have focus and if the value of the text property is an empty string. The placeholder text is shown as grayed-out. When the field receives the focus, the placeholder text disappears. The default value of placeholderText is an empty string.


platformInverted : bool

Symbian:

If platformInverted is true, the component is visualized with the inverted style. For more information, see Using Inverted Style with Symbian Components. By default platformInverted is false.

This property group was introduced in Qt Quick Components 1.1.


searchText : string

The text content of the text input field. The default value is an empty string.


Signal Handler Documentation

SearchBox::backClicked ()

This signal is emitted when the back button is pressed and then released.


SearchBox::clearClicked ()

This signal is emitted when the clear button is pressed and then released.