diff --git a/qml/FullscreenFrame.qml b/qml/FullscreenFrame.qml index 2a8f8bd1..e2c9a2b2 100644 --- a/qml/FullscreenFrame.qml +++ b/qml/FullscreenFrame.qml @@ -419,9 +419,7 @@ InputEventItem { folderId: 0 } sortRole: ItemArrangementProxyModel.IndexInPageRole - Component.onCompleted: { - proxyModel.sort(0) - } + sortColumn: 0 } MouseArea { @@ -666,6 +664,9 @@ InputEventItem { } } Component.onCompleted: { + if (LauncherController.currentFrame === "FullscreenFrame") { + itemMoveTransition.enabled = true + } gridViewContainer.checkPageSwitchState() } Component.onDestruction: { diff --git a/src/models/sortproxymodel.cpp b/src/models/sortproxymodel.cpp index d09f8620..be849061 100644 --- a/src/models/sortproxymodel.cpp +++ b/src/models/sortproxymodel.cpp @@ -196,6 +196,24 @@ void SortProxyModel::setSortRole(int role) } } +void SortProxyModel::setSortColumn(int column) +{ + if (m_sortColumn != column) + { + int oldColumn = m_sortColumn; + m_sortColumn = column; + Q_EMIT sortColumnChanged(); + + // If source model is already set, reorder to apply the new sort column + if (sourceModel() && !m_proxyToSourceMap.empty()) + { + reorder(); + } + + Q_UNUSED(oldColumn) + } +} + int SortProxyModel::sortRole() const { return m_sortRole; diff --git a/src/models/sortproxymodel.h b/src/models/sortproxymodel.h index e9f7b0d5..3953be17 100644 --- a/src/models/sortproxymodel.h +++ b/src/models/sortproxymodel.h @@ -30,12 +30,14 @@ class SortProxyModelTest; * of the API, so if you used QSortFilterProxyModel only for sorting it * should be a drop-in replacement. * - * @note BLumia: Currently, sort() needs to be called manually + * @note sortColumn can be set declaratively in QML to enable + * initial sorting during model reset (no move signals emitted). */ class SortProxyModel : public QAbstractProxyModel { Q_OBJECT Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole NOTIFY sortRoleChanged) + Q_PROPERTY(int sortColumn READ sortColumn WRITE setSortColumn NOTIFY sortColumnChanged) QML_ELEMENT public: @@ -60,6 +62,7 @@ class SortProxyModel : public QAbstractProxyModel public: void setSortRole(int role); int sortRole() const; + void setSortColumn(int column); void setSortCaseSensitivity(Qt::CaseSensitivity sensitivity); Qt::CaseSensitivity sortCaseSensitivity() const; int sortColumn() const;