MauiKit Controls

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

KDE's Doxygen guidelines are available online.