ukui-menu/qml/AppUI/AppPageSearch.qml

46 lines
1.2 KiB
QML
Raw Normal View History

2023-11-29 16:13:50 +08:00
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
2023-11-29 16:13:50 +08:00
import org.ukui.menu.utils 1.0
Item {
property Item focusToPageContent
property bool inputStatus: false
property alias searchInputBar: searchInputBar
2024-01-09 10:08:53 +08:00
2023-11-29 16:13:50 +08:00
SearchInputBar {
id: searchInputBar
property string providerId: "search"
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 16
radius: Platform.Theme.normalRadius
2023-11-29 16:13:50 +08:00
changeFocusTarget: focusToPageContent
visible: true
onTextChanged: {
if (text === "") {
AppPageBackend.group = PluginGroup.Display;
2023-11-29 16:13:50 +08:00
inputStatus = false;
} else {
AppPageBackend.group = PluginGroup.Search;
AppPageBackend.startSearch(text);
2023-11-29 16:13:50 +08:00
inputStatus = true;
}
}
Component.onCompleted: {
text = root.currentSearchText;
}
2023-11-29 16:13:50 +08:00
}
2024-01-09 10:08:53 +08:00
2023-11-29 16:13:50 +08:00
function changeToSearch(keyEvent) {
// if (header.content === null) {
2023-11-29 16:13:50 +08:00
searchInputBar.text = keyEvent;
searchInputBar.textInputFocus();
// }
2023-11-29 16:13:50 +08:00
}
}