Skip to content

Commit fe354c8

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

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

qml/windowed/AlphabetCategoryPopup.qml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Popup {
2222

2323
property alias existingSections: alphabetCategoryDelegateModel.model
2424
property int columns: 5
25+
property string currentCategory: ""
2526

2627
readonly property int cellWidth: 24
2728
readonly property int cellHeight: 24
@@ -31,6 +32,15 @@ Popup {
3132
width: alphabetCategoryContainer.width + 20
3233
height: alphabetCategoryContainer.height + 20
3334

35+
onCurrentCategoryChanged: {
36+
for (let i = 0; i < alphabetCategoryDelegateModel.model.length; i++) {
37+
if (alphabetCategoryDelegateModel.model[i] === currentCategory) {
38+
alphabetCategoryContainer.currentIndex = i
39+
break
40+
}
41+
}
42+
}
43+
3444
DelegateModel {
3545
id: alphabetCategoryDelegateModel
3646

@@ -100,6 +110,18 @@ Popup {
100110
activeFocusOnTab: gridViewFocus
101111
}
102112

113+
Item {
114+
focus: root.visible
115+
Keys.onPressed: function (event) {
116+
if (event.key === Qt.Key_Left ||
117+
event.key === Qt.Key_Right ||
118+
event.key === Qt.Key_Up ||
119+
event.key === Qt.Key_Down) {
120+
alphabetCategoryContainer.focus = true
121+
}
122+
}
123+
}
124+
103125
background: FloatingPanel {
104126
radius: DStyle.Style.popup.radius
105127
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.currentCategory = 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ FocusScope {
3636
readonly property alias gridViewWidth: gridView.width
3737
property alias highlight: gridView.highlight
3838
property ScrollBar vScrollBar
39+
property alias currentIndex: gridView.currentIndex
40+
property alias highlightMoveDuration: gridView.highlightMoveDuration
3941

4042
function positionViewAtBeginning() {
4143
gridView.positionViewAtBeginning()

0 commit comments

Comments
 (0)