Warning, /frameworks/kirigami/src/controls/CardsListView.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>
0003 *
0004 * SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import org.kde.kirigami as Kirigami
0010 /**
0011 * CardsListView is a ListView which can have AbstractCard as its delegate: it will
0012 * automatically assign the proper spacings and margins around the cards adhering
0013 * to the design guidelines.
0014 *
0015 * CardsListView should be used only with cards which can look good at any
0016 * horizontal size, so it is recommended to directly use AbstractCard with an
0017 * appropriate layout inside, because they are stretching for the whole list width.
0018 *
0019 * Therefore, it is discouraged to use it with the Card type.
0020 *
0021 * The choice between using this view with AbstractCard or a normal ListView
0022 * is purely a choice based on aesthetics alone.
0023 *
0024 * It is recommended to use default values.
0025 *
0026 * @inherit QtQuick.ListView
0027 * @since 2.4
0028 */
0029 ListView {
0030 id: root
0031 spacing: Kirigami.Units.largeSpacing * 2
0032 topMargin: headerPositioning !== ListView.InlineHeader ? spacing : 0
0033 rightMargin: Kirigami.Units.largeSpacing * 2
0034 leftMargin: Kirigami.Units.largeSpacing * 2
0035 reuseItems: true
0036
0037 headerPositioning: ListView.OverlayHeader
0038
0039 Keys.onPressed: event => {
0040 if (event.key === Qt.Key_Home) {
0041 positionViewAtBeginning();
0042 currentIndex = 0;
0043 event.accepted = true;
0044 }
0045 else if (event.key === Qt.Key_End) {
0046 positionViewAtEnd();
0047 currentIndex = count - 1;
0048 event.accepted = true;
0049 }
0050 }
0051 }