ukui-menu/qml/AppUI/AppPageSearch.qml

40 lines
1.1 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 AppControls2 1.0 as AppControls2
import org.ukui.menu.utils 1.0
Item {
property Item focusToPageContent
property bool inputStatus: false
id: appPageSearchBar
SearchInputBar {
id: searchInputBar
property string providerId: "search"
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 16
radius: 6 //change theme
changeFocusTarget: focusToPageContent
visible: true
onTextChanged: {
if (text === "") {
appPageHeaderUtils.model(PluginGroup.SortMenuItem).reactivateProvider();
inputStatus = false;
} else {
appPageHeaderUtils.activateProvider(providerId);
appPageHeaderUtils.startSearch(text);
inputStatus = true;
}
}
}
function changeToSearch(keyEvent) {
if (header.content === null) {
searchInputBar.text = keyEvent;
searchInputBar.textInputFocus();
}
}
}