Changeset View
Changeset View
Standalone View
Standalone View
sidebar/package/contents/ui/CategoriesPage.qml
Show All 36 Lines | 36 | anchors { | |||
---|---|---|---|---|---|
37 | fill: parent | 37 | fill: parent | ||
38 | margins: Kirigami.Units.smallSpacing | 38 | margins: Kirigami.Units.smallSpacing | ||
39 | } | 39 | } | ||
40 | QtControls.ToolButton { | 40 | QtControls.ToolButton { | ||
41 | id: menuButton | 41 | id: menuButton | ||
42 | iconName: "application-menu" | 42 | iconName: "application-menu" | ||
43 | Layout.maximumWidth: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 | 43 | Layout.maximumWidth: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 | ||
44 | Layout.maximumHeight: width | 44 | Layout.maximumHeight: width | ||
45 | Keys.onBacktabPressed: { | ||||
46 | root.focusPreviousRequest() | ||||
47 | } | ||||
45 | menu: QtControls.Menu { | 48 | menu: QtControls.Menu { | ||
46 | id: globalMenu | 49 | id: globalMenu | ||
47 | QtControls.MenuItem { | 50 | QtControls.MenuItem { | ||
48 | text: i18n("Configure") | 51 | text: i18n("Configure") | ||
49 | iconName: "settings-configure" | 52 | iconName: "settings-configure" | ||
50 | onTriggered: systemsettings.triggerGlobalAction("configure"); | 53 | onTriggered: systemsettings.triggerGlobalAction("configure"); | ||
51 | } | 54 | } | ||
52 | QtControls.MenuItem { | 55 | QtControls.MenuItem { | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 117 | Kirigami.Heading { | |||
126 | } | 129 | } | ||
127 | } | 130 | } | ||
128 | ListView { | 131 | ListView { | ||
129 | id: categoryView | 132 | id: categoryView | ||
130 | anchors.fill: parent | 133 | anchors.fill: parent | ||
131 | model: systemsettings.categoryModel | 134 | model: systemsettings.categoryModel | ||
132 | currentIndex: systemsettings.activeCategory | 135 | currentIndex: systemsettings.activeCategory | ||
133 | onContentYChanged: systemsettings.hideToolTip(); | 136 | onContentYChanged: systemsettings.hideToolTip(); | ||
137 | activeFocusOnTab: true | ||||
138 | keyNavigationWraps: true | ||||
139 | Accessible.role: Accessible.List | ||||
140 | Keys.onTabPressed: { | ||||
141 | if (applicationWindow().wideScreen) { | ||||
142 | subCategoryColumn.focus = true; | ||||
143 | } else { | ||||
144 | root.focusNextRequest(); | ||||
145 | } | ||||
146 | } | ||||
134 | section { | 147 | section { | ||
135 | property: "categoryDisplayRole" | 148 | property: "categoryDisplayRole" | ||
136 | delegate: Kirigami.AbstractListItem { | 149 | delegate: Kirigami.AbstractListItem { | ||
137 | enabled: false | 150 | enabled: false | ||
138 | separatorVisible: false | 151 | separatorVisible: false | ||
139 | RowLayout { | 152 | RowLayout { | ||
140 | anchors { | 153 | anchors { | ||
141 | left: parent.left | 154 | left: parent.left | ||
Show All 12 Lines | |||||
154 | } | 167 | } | ||
155 | } | 168 | } | ||
156 | 169 | | |||
157 | delegate: Kirigami.BasicListItem { | 170 | delegate: Kirigami.BasicListItem { | ||
158 | id: delegate | 171 | id: delegate | ||
159 | icon: model.decoration | 172 | icon: model.decoration | ||
160 | label: model.display | 173 | label: model.display | ||
161 | separatorVisible: false | 174 | separatorVisible: false | ||
162 | activeFocusOnTab: root.pageStack.currentIndex == 0 | | |||
163 | highlighted: focus | 175 | highlighted: focus | ||
176 | Accessible.role: Accessible.ListItem | ||||
177 | Accessible.name: model.display | ||||
164 | onClicked: { | 178 | onClicked: { | ||
165 | if (systemsettings.activeCategory == index) { | 179 | if (systemsettings.activeCategory == index) { | ||
166 | root.pageStack.currentIndex = 1; | 180 | root.pageStack.currentIndex = 1; | ||
167 | } else { | 181 | } else { | ||
168 | systemsettings.activeCategory = index; | 182 | systemsettings.activeCategory = index; | ||
169 | subCategoryColumn.title = model.display; | 183 | subCategoryColumn.title = model.display; | ||
170 | } | 184 | } | ||
171 | } | 185 | } | ||
172 | onHoveredChanged: { | 186 | onHoveredChanged: { | ||
173 | if (hovered) { | 187 | if (hovered) { | ||
174 | systemsettings.requestToolTip(index, delegate.mapToItem(root, 0, 0, width, height)); | 188 | systemsettings.requestToolTip(index, delegate.mapToItem(root, 0, 0, width, height)); | ||
175 | } else { | 189 | } else { | ||
176 | systemsettings.hideToolTip(); | 190 | systemsettings.hideToolTip(); | ||
177 | } | 191 | } | ||
178 | } | 192 | } | ||
179 | onFocusChanged: { | 193 | onFocusChanged: { | ||
180 | if (focus) { | 194 | if (focus) { | ||
181 | onCurrentIndexChanged: categoryView.positionViewAtIndex(index, ListView.Contain); | 195 | onCurrentIndexChanged: categoryView.positionViewAtIndex(index, ListView.Contain); | ||
182 | } | 196 | } | ||
183 | } | 197 | } | ||
184 | checked: systemsettings.activeCategory == index | 198 | checked: systemsettings.activeCategory == index | ||
185 | Keys.onPressed: { | | |||
186 | switch (event.key) { | | |||
187 | case Qt.Key_Up: | | |||
188 | delegate.nextItemInFocusChain(false).forceActiveFocus(); | | |||
189 | break; | | |||
190 | case Qt.Key_Down: | | |||
191 | delegate.nextItemInFocusChain(true).forceActiveFocus(); | | |||
192 | break; | | |||
193 | default: | | |||
194 | break; | | |||
195 | } | | |||
196 | } | | |||
197 | } | 199 | } | ||
198 | } | 200 | } | ||
199 | } | 201 | } |