KDeclarative

GridViewInternal.qml
1 /*
2  SPDX-FileCopyrightText: 2019 Marco Martin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 import QtQuick 2.7
8 import QtQuick.Layouts 1.1
9 import QtQuick.Controls 2.2 as QtControls
10 import org.kde.kirigami 2.3 as Kirigami
11 
12 
13 GridView {
14  id: view
15 
16  property int implicitCellWidth: Kirigami.Units.gridUnit * 10
17  property int implicitCellHeight: Math.round(implicitCellWidth / 1.6) + Kirigami.Units.gridUnit*3
18 
22  property bool neutralHighlight: false
23 
24  onCurrentIndexChanged: positionViewAtIndex(currentIndex, GridView.Contain);
25 
26  QtObject {
27  id: internal
28  readonly property int availableWidth: scroll.width - internal.scrollBarSpace - 4
29  readonly property int scrollBarSpace: scroll.QtControls.ScrollBar.vertical.width
30  }
31  anchors {
32  fill: parent
33  margins: 2
34  leftMargin: scroll.QtControls.ScrollBar.vertical.visible ? 2 : Math.round(internal.scrollBarSpace/2) + 2
35  }
36  clip: true
37  activeFocusOnTab: true
38 
39  cellWidth: Math.floor(internal.availableWidth / Math.max(Math.floor(internal.availableWidth / (implicitCellWidth + Kirigami.Units.gridUnit)), 2))
40  cellHeight: Kirigami.Settings.isMobile ? cellWidth/1.6 + Kirigami.Units.gridUnit : implicitCellHeight
41 
42  keyNavigationEnabled: true
43  keyNavigationWraps: true
44  highlightMoveDuration: 0
45 
46  remove: Transition {
47  ParallelAnimation {
48  NumberAnimation { property: "scale"; to: 0.5; duration: Kirigami.Units.longDuration }
49  NumberAnimation { property: "opacity"; to: 0.0; duration: Kirigami.Units.longDuration }
50  }
51  }
52 
53  removeDisplaced: Transition {
54  SequentialAnimation {
55  // wait for the "remove" animation to finish
56  PauseAnimation { duration: Kirigami.Units.longDuration }
57  NumberAnimation { properties: "x,y"; duration: Kirigami.Units.longDuration }
58  }
59  }
60 }
KGuiItem properties()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:44:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.