diff --git a/src/gui/Base/HGridView.qml b/src/gui/Base/HGridView.qml index 56350e85..6ca91c04 100644 --- a/src/gui/Base/HGridView.qml +++ b/src/gui/Base/HGridView.qml @@ -6,6 +6,8 @@ import QtQuick.Controls 2.12 GridView { id: gridView + property int defaultCurrentIndex: -1 + property alias cursorShape: mouseArea.cursorShape property int currentItemHeight: currentItem ? currentItem.height : 0 @@ -65,7 +67,7 @@ GridView { } - currentIndex: -1 + currentIndex: defaultCurrentIndex keyNavigationWraps: true highlightMoveDuration: theme.animationDuration @@ -118,6 +120,7 @@ GridView { } onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0 + onModelChanged: currentIndex = defaultCurrentIndex HKineticScrollingDisabler { id: mouseArea diff --git a/src/gui/Base/HListView.qml b/src/gui/Base/HListView.qml index 77037da7..2cec4317 100644 --- a/src/gui/Base/HListView.qml +++ b/src/gui/Base/HListView.qml @@ -6,6 +6,8 @@ import QtQuick.Controls 2.12 ListView { id: listView + property int defaultCurrentIndex: -1 + property int currentItemHeight: currentItem ? currentItem.height : 0 property var checked: ({}) @@ -76,7 +78,7 @@ ListView { } - currentIndex: -1 + currentIndex: defaultCurrentIndex keyNavigationWraps: true highlightMoveDuration: theme.animationDuration highlightResizeDuration: theme.animationDuration @@ -135,6 +137,7 @@ ListView { } onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0 + onModelChanged: currentIndex = defaultCurrentIndex HKineticScrollingDisabler { width: enabled ? parent.width : 0