Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/imagepackage/contents/ui/config.qml
Show First 20 Lines • Show All 282 Lines • ▼ Show 20 Line(s) | 275 | GridView { | |||
---|---|---|---|---|---|
283 | 283 | | |||
284 | anchors.margins: 4 | 284 | anchors.margins: 4 | ||
285 | boundsBehavior: Flickable.StopAtBounds | 285 | boundsBehavior: Flickable.StopAtBounds | ||
286 | 286 | | |||
287 | delegate: WallpaperDelegate { | 287 | delegate: WallpaperDelegate { | ||
288 | color: cfg_Color | 288 | color: cfg_Color | ||
289 | } | 289 | } | ||
290 | 290 | | |||
291 | onCountChanged: { | ||||
292 | wallpapersGrid.currentIndex = imageWallpaper.wallpaperModel.indexOf(cfg_Image); | ||||
293 | wallpapersGrid.positionViewAtIndex(wallpapersGrid.currentIndex, GridView.Visible) | ||||
294 | } | ||||
295 | | ||||
291 | Connections { | 296 | Connections { | ||
292 | target: root | 297 | target: root | ||
293 | onRestoreIndex: { | 298 | onRestoreIndex: { | ||
294 | wallpapersGrid.currentIndex = wallpapersGrid.currentIndex - count | 299 | wallpapersGrid.currentIndex = wallpapersGrid.currentIndex - count | ||
295 | } | 300 | } | ||
296 | } | 301 | } | ||
297 | 302 | | |||
298 | Timer { | | |||
299 | id: makeCurrentTimer | | |||
300 | interval: 100 | | |||
301 | repeat: false | | |||
302 | property string pendingIndex | | |||
303 | onTriggered: { | | |||
304 | wallpapersGrid.currentIndex = pendingIndex | | |||
305 | wallpapersGrid.forceActiveFocus(); | | |||
306 | } | | |||
307 | } | | |||
308 | | ||||
309 | Keys.onPressed: { | 303 | Keys.onPressed: { | ||
310 | if (count < 1) { | 304 | if (count < 1) { | ||
311 | return; | 305 | return; | ||
312 | } | 306 | } | ||
313 | 307 | | |||
314 | if (event.key == Qt.Key_Home) { | 308 | if (event.key == Qt.Key_Home) { | ||
315 | currentIndex = 0; | 309 | currentIndex = 0; | ||
316 | } else if (event.key == Qt.Key_End) { | 310 | } else if (event.key == Qt.Key_End) { | ||
317 | currentIndex = count - 1; | 311 | currentIndex = count - 1; | ||
318 | } | 312 | } | ||
319 | } | 313 | } | ||
320 | 314 | | |||
321 | Keys.onLeftPressed: moveCurrentIndexLeft() | 315 | Keys.onLeftPressed: moveCurrentIndexLeft() | ||
322 | Keys.onRightPressed: moveCurrentIndexRight() | 316 | Keys.onRightPressed: moveCurrentIndexRight() | ||
323 | Keys.onUpPressed: moveCurrentIndexUp() | 317 | Keys.onUpPressed: moveCurrentIndexUp() | ||
324 | Keys.onDownPressed: moveCurrentIndexDown() | 318 | Keys.onDownPressed: moveCurrentIndexDown() | ||
325 | 319 | | |||
326 | Connections { | 320 | Connections { | ||
327 | target: imageWallpaper | 321 | target: imageWallpaper | ||
328 | onCustomWallpaperPicked: wallpapersGrid.currentIndex = 0 | 322 | onCustomWallpaperPicked: { | ||
323 | wallpapersGrid.currentIndex = 0 | ||||
324 | } | ||||
329 | } | 325 | } | ||
330 | 326 | | |||
331 | } | 327 | } | ||
332 | } | 328 | } | ||
333 | } | 329 | } | ||
334 | 330 | | |||
335 | Loader { | 331 | Loader { | ||
336 | Layout.fillWidth: true | 332 | Layout.fillWidth: true | ||
Show All 28 Lines |