Warning, /maui/mauikit/src/controls.6/PageLayout.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   Copyright 2019 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 QtQml
0022 import QtQuick.Controls
0023 import QtQuick.Layouts
0024 
0025 import org.mauikit.controls 1.3 as Maui
0026 
0027 /**
0028  * @inherit Page
0029  * @brief A MauiKit Page with a toolbar bar content that is dynamically split onto two bars upon request.
0030  * This control inherits from MauiKit Page, to checkout its inherited properties refer to docs.
0031  * 
0032  * The default header for the Page is set to MauiKit ToolBar, which is divided into three main sections; the left and right side section are the one that can be wrapped into another tool bar when requested - for example, due to space constrains.
0033  * To know more see the ToolBar documentation.
0034  * @see ToolBar
0035  * @see Page
0036  * 
0037  * For it to work just populate the left and right side sections. And then set a constrain check on the `split` property.
0038  * When it is set to `split: true`, the left and right side contents will be moved to a new tool bar under the main header.
0039  * @see leftContent
0040  * @see middleContent
0041  * @see rightContent
0042  * 
0043  * @image html Misc/pagelayout.png
0044  * 
0045  * @warning It is important to not change the `header` to a different control. PageLayout depends on MauiKit ToolBar being used.
0046  *  
0047  * @code
0048  * Maui.PageLayout
0049  * {
0050  *    id: _page
0051  * 
0052  *    anchors.fill: parent
0053  *    Maui.Controls.showCSD: true
0054  * 
0055  *    split: width < 600
0056  *    leftContent: [Switch
0057  *        {
0058  *            text: "Hello"
0059  *        },
0060  * 
0061  *        Button
0062  *        {
0063  *            text: "Button"
0064  *        }
0065  *    ]
0066  * 
0067  *    rightContent: Rectangle
0068  *    {
0069  *        height: 40
0070  *        implicitWidth: 60
0071  *        color: "gray"
0072  *    }
0073  * 
0074  *    middleContent: Rectangle
0075  *    {
0076  *        implicitHeight: 40
0077  *        implicitWidth: 60
0078  *        Layout.alignment: Qt.AlignHCenter
0079  *        Layout.fillWidth: _page.split
0080  *        color: "yellow"
0081  *    }
0082  * }
0083  * @endcode
0084  * 
0085  * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/PageLayout.qml">You can find a more complete example at this link.</a>
0086  */
0087 Maui.Page
0088 {
0089     id: control
0090     
0091     /**
0092      * @brief The toolbar left side content.
0093      * This content will be wrapped into a secondary tool bar under the header.
0094      */
0095     property list<QtObject> leftContent
0096     
0097     /**
0098      * @brief The toolbar bar right side content.
0099      * This content will be wrapped into a secondary tool bar under the header.
0100      */
0101     property list<QtObject> rightContent 
0102     
0103     /**
0104      * @brief The toolbar middle content.
0105      * This elements will not be wrapped and will stay in place.
0106      * @note The contents are placed using a RowLayout, so use the layout attached properties accordingly. 
0107      */
0108     property  list<QtObject> middleContent : control.headBar.middleContent
0109     
0110     /**
0111      * @brief Whether the toolbar content should be wrapped - as in split - into a new secondary toolbar.
0112      * By default this is set to `false`. 
0113      * @note You can bind this to some space constrain condition.
0114      */
0115     property bool split : false
0116     
0117     headBar.forceCenterMiddleContent: !control.split
0118     headBar.leftContent: !control.split && control.leftContent ? control.leftContent : null
0119     headBar.rightContent: !control.split && control.rightContent ? control.rightContent : null    
0120     
0121     headBar.middleContent: control.middleContent ? control.middleContent : null
0122     
0123     headerColumn: Maui.ToolBar
0124     {
0125         visible: control.split
0126         width: parent.width
0127         
0128         leftContent: control.split && control.leftContent ? control.leftContent : null    
0129         rightContent: control.split && control.rightContent ? control.rightContent : null        
0130     }
0131 }