Pages
API Documentation
On this page

SearchDialog QML Type

A dialog to let's you do a global search across your applications documents, chat rooms and more. This type was introduced in Qt 6.3. More...

  • Import Statement: import org.kde.kirigami.dialogs
  • Since: Qt 6.3
  • Inherits: Dialog

Detailed Description

Example usage for a chat app where we want to quickly search for a room.

import QtQuick
import org.kde.kitemmodels as KItemModels
import org.kde.kirigami as Kirigami

Kirigami.SearchDialog {
   id: root

   onTextChanged: {
       sortModel.filterString = text;
   }
   onAccepted: listView.currentItem.clicked()

   emptyText: i18nc("Placeholder message", "No room found.")

   model: KItemModels.KSortFilterProxyModel {
       id: sortModel

       sourceModel: RoomModel { }
   }

   delegate: RoomDelegate {
       onClicked: root.close()
   }

   Shortcut {
       sequence: "Ctrl+K"
       onActivated: root.open()
   }
}

Note: This component is unsuitable on mobile. Instead on mobile prefer to use a separate page for the search.

Note: By default, the title and standardButtons property are ignored.

Property Documentation

count : int

This property holds the number of search results displayed in the internal ListView.

currentItem : Item

This property holds an alias to the currentItem component of the internal ListView.

delegate : Component

This property holds an alias to the delegate component of the internal ListView.

[since 6.10] emptyHelpfulAction : Action

Helpful action when the list is empty

This property holds an alias to the helpful action of the placeholder message when the internal list view is empty.

This property was introduced in Qt 6.10.

emptyIcon group

emptyIcon.color : color

emptyIcon.height : int

emptyIcon.name : string

emptyIcon.source : string

emptyIcon.width : int

This property holds an alias to the placeholder message icon displayed when the internal list view is empty.

emptyText : string

This property holds an alias to the placeholder message text displayed when the internal list view is empty.

model : model

This property holds an alias to the model of the internal ListView.

searchFieldLeftActions : Action

This property holds an alias to the left actions of the search field.

See also ActionTextField::leftActions

searchFieldPlaceholderText : string

The placeholder text shown in the (empty) search field.

searchFieldRightActions : Action

This property holds an alias to the right actions of the search field.

See also ActionTextField::rightActions

section group

section.criteria : enumeration

section.delegate : Component

section.labelPositioning : enumneration

section.property : string

This property holds an alias to the section component of the internal ListView.

text : string

This property holds an alias to the content of the search field.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.