From 2da1bb150faf50541bf0c38bdfca232a53523cde Mon Sep 17 00:00:00 2001 From: Yari Polla Date: Mon, 20 Mar 2023 15:12:55 +0100 Subject: [PATCH] components/gridview: simplify component --- .../mobileshell/qml/components/GridView.qml | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/components/mobileshell/qml/components/GridView.qml b/components/mobileshell/qml/components/GridView.qml index 62077f87..4b3c90dc 100644 --- a/components/mobileshell/qml/components/GridView.qml +++ b/components/mobileshell/qml/components/GridView.qml @@ -1,16 +1,15 @@ // SPDX-FileCopyrightText: 2022 Devin Lin // SPDX-License-Identifier: GPL-2.0-or-later -import QtQuick -import QtQuick.Controls +import QtQuick as QQ -import org.kde.plasma.core as PlasmaCore -import org.kde.kirigami as Kirigami +import org.kde.plasma.extras as PlasmaExtras + +QQ.GridView { + id: root -GridView { maximumFlickVelocity: 5000 - highlightFollowsCurrentItem: true highlight: highlightComponent /** These function are called when the user tries to move the highlight outside the allowed surface by using arrow keys. @@ -21,7 +20,7 @@ GridView { property var leftEdgeCallback: null property var rightEdgeCallback: null - Keys.onPressed: event => { + QQ.Keys.onPressed: event => { if (!currentItem) { return; } @@ -70,14 +69,9 @@ GridView { } } - Component { + QQ.Component { id: highlightComponent - Rectangle { - color: Kirigami.ColorUtils.tintWithAlpha(PlasmaCore.ColorScope.highlightColor, PlasmaCore.ColorScope.backgroundColor, 0.6) - radius: PlasmaCore.Units.smallSpacing - Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } } - Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } } - } + PlasmaExtras.Highlight {} } }