MauiKit Controls

AppViewLoader.qml
1/*
2 * Copyright 2020 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
21import QtQuick.Controls
22import org.mauikit.controls 1.3 as Maui
23
24/**
25 * @inherit QtQuick.Loader
26 * @since org.mauikit.controls 1.0
27 *
28 * @brief A companion for the AppViews control, for lazy-loading the views to not drain too much resources.
29 *
30 * <a href="https://doc.qt.io/qt-6/qml-qtquick-controls-loader.html">This controls inherits from QQC2 Loader, to checkout its inherited properties refer to the Qt Docs.</a>
31 *
32 * This element wraps a component into a loader that is active only if it is the next, current or previous view in use, or if it has already been created once.
33 * This component is useful when the AppViews has more then 4 different views to relief the loading of many views at the same time all at once.
34 *
35 * This control will also display a progress bar element at the bottom of the view - indicating the progress of loading the hosted component.
36 * @see ProgressIndicator
37 *
38 * @note Remeber to set the AppView information, such as title and icon, using the attached properties.
39 * @see AppView
40 *
41 * @code
42 * AppViews
43 * {
44 * AppViewLoader
45 * {
46 * AppView.title: i18n("Songs")
47 * AppView.iconName: "view-media-track"
48 *
49 * Item { } ///The child element to be used as the Component to be loaded.
50 * }
51 * }
52 * @endcode
53 *
54 * @note To improve the efficiency of loading time, this control will load its component asynchronously. This can be disabled by setting `asynchronous: false`
55 *
56 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/AppViewLoader.qml">You can find a more complete example at this link.</a>
57 *
58 *
59 */
60Loader
61{
62 id: control
63
64 asynchronous: true
65 active: (SwipeView.view.visible && SwipeView.isCurrentItem) || item
66
67 /**
68 * @brief By default the single element declared as the child will be used as the component to be loaded.
69 * @property Component AppViewLoader::content
70 */
71 default property alias content : control.sourceComponent
72
73 Maui.ProgressIndicator
74 {
75 width: parent.width
76 anchors.bottom: parent.bottom
77 visible: control.status === Loader.Loading
78 }
79}
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.