Warning, /maui/mauikit/src/controls.6/AppViewLoader.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2020 Camilo Higuita <milo.h@aol.com>
0003 *
0004 * This program is free software; you can redistribute it and/or modify
0005 * it under the terms of the GNU Library General Public License as
0006 * published by the Free Software Foundation; either version 2, or
0007 * (at your option) any later version.
0008 *
0009 * This program is distributed in the hope that it will be useful,
0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012 * GNU General Public License for more details
0013 *
0014 * You should have received a copy of the GNU Library General Public
0015 * License along with this program; if not, write to the
0016 * Free Software Foundation, Inc.,
0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019
0020 import QtQuick
0021 import QtQuick.Controls
0022 import org.mauikit.controls 1.3 as Maui
0023
0024 /**
0025 * @inherit QtQuick.Loader
0026 * @since org.mauikit.controls 1.0
0027 *
0028 * @brief A companion for the AppViews control, for lazy-loading the views to not drain too much resources.
0029 *
0030 * <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>
0031 *
0032 * 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.
0033 * 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.
0034 *
0035 * This control will also display a progress bar element at the bottom of the view - indicating the progress of loading the hosted component.
0036 * @see ProgressIndicator
0037 *
0038 * @note Remeber to set the AppView information, such as title and icon, using the attached properties.
0039 * @see AppView
0040 *
0041 * @code
0042 * AppViews
0043 * {
0044 * AppViewLoader
0045 * {
0046 * AppView.title: i18n("Songs")
0047 * AppView.iconName: "view-media-track"
0048 *
0049 * Item { } ///The child element to be used as the Component to be loaded.
0050 * }
0051 * }
0052 * @endcode
0053 *
0054 * @note To improve the efficiency of loading time, this control will load its component asynchronously. This can be disabled by setting `asynchronous: false`
0055 *
0056 * <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>
0057 *
0058 *
0059 */
0060 Loader
0061 {
0062 id: control
0063
0064 asynchronous: true
0065 active: (SwipeView.view.visible && SwipeView.isCurrentItem) || item
0066
0067 /**
0068 * @brief By default the single element declared as the child will be used as the component to be loaded.
0069 * @property Component AppViewLoader::content
0070 */
0071 default property alias content : control.sourceComponent
0072
0073 Maui.ProgressIndicator
0074 {
0075 width: parent.width
0076 anchors.bottom: parent.bottom
0077 visible: control.status === Loader.Loading
0078 }
0079 }