mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
components/GridView: implement highlight component
This commit is contained in:
parent
684431a0af
commit
8c31f51ee6
1 changed files with 25 additions and 2 deletions
|
|
@ -1,9 +1,32 @@
|
||||||
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
import org.kde.plasma.core as PlasmaCore
|
||||||
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
maximumFlickVelocity: 5000
|
maximumFlickVelocity: 5000
|
||||||
|
|
||||||
|
highlightFollowsCurrentItem: true
|
||||||
|
highlight: highlightComponent
|
||||||
|
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if (!activeFocus) {
|
||||||
|
currentIndex = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 } }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue