ukui-menu/qml/AppUI/AppPageSearch.qml

41 lines
1.1 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.menu.utils 1.0
Item {
property Item focusToPageContent
property bool inputStatus: false
SearchInputBar {
id: searchInputBar
property string providerId: "search"
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 16
radius: Platform.Theme.normalRadius
changeFocusTarget: focusToPageContent
visible: true
onTextChanged: {
if (text === "") {
AppPageBackend.group = PluginGroup.Display;
inputStatus = false;
} else {
AppPageBackend.group = PluginGroup.Search;
AppPageBackend.startSearch(text);
inputStatus = true;
}
}
}
function changeToSearch(keyEvent) {
if (header.content === null) {
searchInputBar.text = keyEvent;
searchInputBar.textInputFocus();
}
}
}