Debian Codegraph @

branding/image-slideshow/ImageSlide.qml

raw
1 /* === This file is part of Calamares Extensions - <http://github.com/calamares-extensions> ===
2 *
3 * SPDX-FileCopyrightText: 2021 Adriaan de Groot <[email protected]>
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7 /* An *ImageSlide* is a *Slide* (it offers the API that *Presentation*
8 * expects) while displaying only a single image. This is useful
9 * for presentations that are all images, with no interaction or text.
10 */
11
12 import QtQuick 2.5
13
14 /* To use an *ImageSlide*, instantiate it inside your *Presentation*
15 * and set the *src* property to a path to an image file in a supported
16 * format. Relative paths are ok.
17 */
18 Item {
19 id: imageslide
20
21 /* Slides should be non-visible at the start; the *Presentation*
22 * handles visibility (so that one slide at a time is visible).
23 */
24 visible: false
25 /* Make this item fill up the parent, so that alignment of the
26 * image (below) works out to "middle of the parent".
27 */
28 anchors.fill: parent
29
30 /* The *Presentation* manages visibility of children that have
31 * attribute *isSlide* and *isSlide* is set to *true*. Other
32 * children are ignored, so we need to set this so that the
33 * *ImageSlide* elements are treated like slides.
34 */
35 property bool isSlide: true;
36 /* The *Presentation* allows slides to have notes, so just leave
37 * an empty string here.
38 */
39 property string notes;
40
41
42 /* This is the important property for *ImageSlide*: the path to the
43 * image to display. When instantiating *ImageSlide*, set this for
44 * each instance. Relative paths are ok.
45 */
46 property string src;
47
48 /* The image itself. It has fixed sizes (300x150px). You could set
49 * an aspect ratio here (e.g. `height: width / 2`) as well.
50 *
51 * This binds the image source (filename) to the string *src*
52 * in the *ImageSlide* element, for convenience in setting things
53 * up in the overall slideshow. If you want to make width and
54 * height configurable, add a property above and then bind to
55 * them from the Image element.
56 */
57 Image {
58 id: image
59 source: src
60 width: 300
61 height: 150
62 anchors.centerIn: parent
63 }
64 }