feat(FullScreenUI):添加全屏界面搜索结果的按键导航功能(issues:#I76KWQ)
This commit is contained in:
parent
48d26861a9
commit
cb1e8016e7
|
@ -31,6 +31,19 @@ RowLayout {
|
|||
property bool isContentShow: true
|
||||
property int animationDuration: 300
|
||||
|
||||
function viewFocusEnable() {
|
||||
contentViewLoader.focus = true;
|
||||
}
|
||||
function clearViewFocus() {
|
||||
contentViewLoader.focus = false;
|
||||
if (contentViewLoader.item.currentIndex) {
|
||||
contentViewLoader.item.currentIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: mainWindow.visibleChanged.connect(clearViewFocus)
|
||||
Component.onDestruction: mainWindow.visibleChanged.disconnect(clearViewFocus)
|
||||
|
||||
state: isContentShow ? "contentShow" : "contentHidden"
|
||||
states: [
|
||||
State {
|
||||
|
@ -170,10 +183,13 @@ RowLayout {
|
|||
boundsBehavior: Flickable.StopAtBounds
|
||||
model: modelManager.getAppModel()
|
||||
cacheBuffer: cellHeight * appGridView.count / 6
|
||||
focus: true
|
||||
keyNavigationEnabled: true
|
||||
|
||||
delegate: Loader {
|
||||
width: GridView.view.cellWidth
|
||||
height: width
|
||||
focus: true
|
||||
property int index: model.index
|
||||
property int type: model.type
|
||||
property string id: model.id
|
||||
|
@ -195,7 +211,6 @@ RowLayout {
|
|||
id: dropArea
|
||||
property int originalX
|
||||
property int originalY
|
||||
|
||||
onEntered: {
|
||||
if (appGridView.selectId !== id) {
|
||||
imageBase.visible = true;
|
||||
|
@ -209,6 +224,23 @@ RowLayout {
|
|||
appGridView.model.addAppsToFolder(appGridView.selectId, id, "");
|
||||
}
|
||||
}
|
||||
|
||||
// ********按键导航********
|
||||
focus: true
|
||||
states: State {
|
||||
when: dropArea.activeFocus
|
||||
PropertyChanges {
|
||||
target: controlBase
|
||||
borderColor: Palette.Highlight
|
||||
border.width: 2
|
||||
}
|
||||
}
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
||||
appGridView.model.appClicked(index);
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: appItem
|
||||
property bool isSelect: false
|
||||
|
@ -228,12 +260,12 @@ RowLayout {
|
|||
ToolTip.text: name
|
||||
ToolTip.visible: iconText.truncated && containsMouse
|
||||
AppControls2.StyleBackground {
|
||||
id: controlBase
|
||||
anchors.fill: parent
|
||||
useStyleTransparent: false
|
||||
paletteRole: Palette.Light
|
||||
radius: 16
|
||||
alpha: appItem.isSelect ? 0.00 : parent.containsPress ? 0.25 : parent.containsMouse ? 0.15 : 0.00
|
||||
|
||||
Item {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 14
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.ukui.menu.utils 1.0
|
|||
Item {
|
||||
clip: true
|
||||
property alias searchOpacity: searchInputBar.opacity
|
||||
property alias searchText: searchInputBar.text
|
||||
SearchInputBar {
|
||||
id: searchInputBar
|
||||
width: 372; height: 36
|
||||
|
|
|
@ -33,6 +33,8 @@ AppControls2.StyleBackground {
|
|||
borderAlpha: textInput.activeFocus ? 1 : 0.1
|
||||
borderColor: textInput.activeFocus ? Palette.Highlight : Palette.Base
|
||||
|
||||
Component.onCompleted: mainWindow.visibleChanged.connect(clear)
|
||||
Component.onDestruction: mainWindow.visibleChanged.disconnect(clear)
|
||||
function textInputFocus() {
|
||||
textInput.forceActiveFocus();
|
||||
}
|
||||
|
@ -74,7 +76,7 @@ AppControls2.StyleBackground {
|
|||
}
|
||||
|
||||
states: State {
|
||||
when: textInput.activeFocus || !mainWindow.isFullScreen
|
||||
when: !mainWindow.isFullScreen || textInput.text !== "" || textInput.activeFocus
|
||||
AnchorChanges {
|
||||
target: defaultSearch
|
||||
anchors.left: parent.left
|
||||
|
@ -104,6 +106,10 @@ AppControls2.StyleBackground {
|
|||
normalUI.focus = true;
|
||||
changeFocusTarget.focus = true;
|
||||
appPage.content.resetFocus();
|
||||
} else {
|
||||
if (text !== "") {
|
||||
fullScreenContent.viewFocusEnable();
|
||||
}
|
||||
}
|
||||
}
|
||||
Keys.onDownPressed: changeFocusToListView()
|
||||
|
@ -121,8 +127,6 @@ AppControls2.StyleBackground {
|
|||
}
|
||||
onTextColorChanged: updateTextInputColor()
|
||||
Component.onDestruction: themePalette.styleColorChanged.disconnect(updateTextInputColor)
|
||||
|
||||
onFocusChanged: clear()
|
||||
}
|
||||
|
||||
AppControls2.RoundButton {
|
||||
|
|
Loading…
Reference in New Issue