MauiKit Controls

ScrollColumn.qml
1/*
2 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick
21
22import QtQuick.Controls
23import QtQuick.Layouts
24
25import org.mauikit.controls as Maui
26
27/**
28 * @inherit QtQuick.Controls.ScrollView
29 * @brief A QQC2 ScrollView setup ready for adding any children into a column layout that is scrollable.
30 * <a href="https://doc.qt.io/qt-6/qml-qtquick-controls-scrollview.html">This control inherits from QQC2 ScrollView, to checkout its inherited properties refer to the Qt Docs.</a>
31 *
32 * @note The children content is added to a ColumnLayout, so to position the elements use the Layout attached properties.
33 *
34 * @image html Misc/scrollcolumn.gif
35 *
36 * @code
37 * Maui.ScrollColumn
38 * {
39 * anchors.fill: parent
40 *
41 * Rectangle
42 * {
43 * implicitHeight: 600
44 * Layout.fillWidth: true
45 * color: "purple"
46 * }
47 *
48 * Rectangle
49 * {
50 * implicitHeight: 200
51 * Layout.fillWidth: true
52 * color: "orange"
53 * }
54 *
55 * Rectangle
56 * {
57 * implicitHeight: 300
58 * Layout.fillWidth: true
59 * color: "yellow"
60 * }
61 * }
62 * @endcode
63 *
64 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/ScrollColumn.qml">You can find a more complete example at this link.</a>
65 */
66ScrollView
67{
68 id: control
70 /**
71 * @brief The default content declared as the children is placed unser a ColumnLayout.
72 * @property list<QtObject> ScrollColumn::content
73 */
74 default property alias content : _pageContent.data
76 /**
77 * @brief An alias to the children container hanlded by a QQC2 ColumnLayout.
78 * @property ColumnLayout ScrollColumn::container
79 */
80 readonly property alias container : _pageContent
81
82 /**
83 * @brief An alias to the QQC2 Flickable element that allows to flick the content. This is exposed to allow to access the Flcikable properties.
84 * @note See Qt documentation on the Flickable type.
85 *@property Flickable ScrollColumn::flickable
86 */
87 readonly property alias flickable: _flickable
88
89 padding: Maui.Style.contentMargins
90
91 contentWidth: availableWidth
92 contentHeight: _pageContent.implicitHeight
93
94 implicitHeight: contentHeight + topPadding + bottomPadding
95
96 spacing: Maui.Style.defaultSpacing
97
98 Flickable
99 {
100 id: _flickable
101
102 interactive: Maui.Handy.hasTransientTouchInput
103
104 boundsBehavior: Flickable.StopAtBounds
105 boundsMovement: Flickable.StopAtBounds
106
107 ColumnLayout
108 {
109 id: _pageContent
110 width: parent.width
111 spacing: control.spacing
112 }
113 }
114}
115
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:55:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.