File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ()
You can’t perform that action at this time.
0 commit comments