Skip to content

Commit 988aee8

Browse files
committed
feat: add focus with AlphabetCategory when change to another word.
as title. PMS-BUG-289159
1 parent 67784c6 commit 988aee8

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

qml/windowed/AlphabetCategoryPopup.qml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ Popup {
3131
width: alphabetCategoryContainer.width + 20
3232
height: alphabetCategoryContainer.height + 20
3333

34+
function setCurrentCategory(category) {
35+
for (let i = 0; i < alphabetCategoryDelegateModel.model.length; i++) {
36+
if (alphabetCategoryDelegateModel.model[i] === category) {
37+
alphabetCategoryContainer.currentIndex = i
38+
break
39+
}
40+
}
41+
}
42+
3443
DelegateModel {
3544
id: alphabetCategoryDelegateModel
3645

@@ -100,6 +109,18 @@ Popup {
100109
activeFocusOnTab: gridViewFocus
101110
}
102111

112+
Item {
113+
focus: root.visible
114+
Keys.onPressed: function (event) {
115+
if (event.key === Qt.Key_Left ||
116+
event.key === Qt.Key_Right ||
117+
event.key === Qt.Key_Up ||
118+
event.key === Qt.Key_Down) {
119+
alphabetCategoryContainer.focus = true
120+
}
121+
}
122+
}
123+
103124
background: FloatingPanel {
104125
radius: DStyle.Style.popup.radius
105126
dropShadowColor: null

qml/windowed/AppListView.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ FocusScope {
129129
onClicked: {
130130
if (CategorizedSortProxyModel.categoryType === CategorizedSortProxyModel.Alphabetary) {
131131
alphabetCategoryPopup.existingSections = CategorizedSortProxyModel.alphabetarySections()
132+
alphabetCategoryPopup.setCurrentCategory(section.toUpperCase())
132133
var mousePos = mapToItem(listView, mouseX, mouseY)
133134
var y = (mousePos.y + alphabetCategoryPopup.height) < listView.height ? mousePos.y : listView.height - alphabetCategoryPopup.height
134135
alphabetCategoryPopup.y = y

qml/windowed/GridViewContainer.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ FocusScope {
3636
readonly property alias gridViewWidth: gridView.width
3737
property alias highlight: gridView.highlight
3838
property ScrollBar vScrollBar
39+
property alias currentIndex: gridView.currentIndex
3940

4041
function positionViewAtBeginning() {
4142
gridView.positionViewAtBeginning()

0 commit comments

Comments
 (0)