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