MauiKit Controls

GalleryRollItem.qml
1import QtQuick
2import QtQuick.Controls
3
4import org.mauikit.controls as Maui
5
6/**
7 * @inherit GridBrowserDelegate
8 * @since org.mauikit.controls
9 *
10 * @brief A custom item to be used as a delegate in the browsing views or as a standalone card. This element presents a group of images in a carousel form.
11 *
12 * This control inherits all properties from the MauiKit GridBrowserDelegate control. As such, this can have two labels, for a title and a message.
13 * @see GridBrowserDelegate#label1
14 * @see GridBrowserDelegate#label2
15 *
16 * The header part of this control, the actual carousel of images, is handled by a GalleryRollTemplate.
17 * @see GalleryRollTemplate
18 *
19 * @image html Delegates/galleryrollitem.png
20 *
21 * @code
22 * Maui.GridBrowser
23 * {
24 * anchors.fill: parent
25 * model: 30
26 *
27 * itemSize: 200
28 *
29 * delegate: Item
30 * {
31 * width: GridView.view.cellWidth
32 * height: GridView.view.cellHeight
33 *
34 * Maui.GalleryRollItem
35 * {
36 * anchors.fill: parent
37 * anchors.margins: Maui.Style.space.small
38 *
39 * label1.text: "Demo"
40 * label2.text: index
41 * images: index %2 === 0 ? ['/home/camiloh/Downloads/street-1234360.jpg', '/home/camiloh/Downloads/flat-coated-retriever-1339154.jpg', '/home/camiloh/Downloads/5911329.jpeg'] : ['/home/camiloh/Downloads/street-1234360.jpg', '/home/camiloh/Downloads/flat-coated-retriever-1339154.jpg', '/home/camiloh/Downloads/5911329.jpeg', '/home/camiloh/Pictures/LastLights_by_Mushcube/LastLightsScreenPreview.png']
42 * }
43 * }
44 * }
45 * @endcode
46 *
47 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/GalleryRollItem.qml">You can find a more complete example at this link.</a>
48 *
49 */
50Maui.GridBrowserDelegate
51{
52 id: control
53
54 /**
55 * @brief Whether the images should be saved in the cache, to reduce loading times.
56 * By default this is set to `true`.
57 */
58 property bool cache : true
59
60
61 /**
62 * @brief A list of images to be used. This will be use as the model.
63 */
64 property var images : []
65
66 /**
67 * @brief A callback function to manage what image is positioned. This callback function is called for each image source set in the model `images`, so the final source can be modified. This function should return a - new or modified - image source URL.
68 *
69 * As an example, if the `images` model looks like: `["page1", "page2", "page3"]` - which are not file URLs, this callback function can be use to map each individual source to an actual file URL.
70 * @code
71 * images: ["page1", "page2", "page3"]
72 * cb : (source) =>
73 * {
74 * return mapSourceToImageFile(source) //here the "page1" could be mapped to "file:///some/path/to/image1.jpg" and return this new source to be use.
75 * }
76 * @endcode
77 */
78 property var cb
79
80 /**
81 * @brief The orientation of the transition of the images. By default this is set to horizontal using `ListView.Horizontal`.
82 * Possible values are:
83 * - ListView.Horizontal
84 * - ListView.Vertical
85 */
86 property int orientation : Qt.Horizontal
87
88 label1.font.weight: Font.DemiBold
89 label1.font.pointSize: Maui.Style.fontSizes.big
90 template.labelSizeHint: 32
91 template.alignment: Qt.AlignLeft
92
93 maskRadius: radius
94
95 template.iconComponent: Maui.GalleryRollTemplate
96 {
97 radius: control.radius
98 cache: control.cache
99 images: control.images
100 cb: control.cb
101 fillMode: control.fillMode
102 running: !control.hovered && !control.checked
103 imageWidth: control.imageWidth
104 imageHeight: control.imageHeight
105
106 corners
107 {
108 topLeftRadius: control.radius
109 topRightRadius: control.radius
110 bottomLeftRadius: control.radius
111 bottomRightRadius: control.radius
112 }
113 }
114}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:48:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.