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

0001 /*
0002  *   Copyright 2018 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 2.14
0021 import QtQuick.Controls 2.14
0022 
0023 import org.mauikit.controls 1.3 as Maui
0024 
0025 import QtQuick.Templates 2.15 as T
0026 
0027 /**
0028  * LabelDelegate
0029  * A global sidebar for the application window that can be collapsed.
0030  *
0031  *
0032  *
0033  *
0034  *
0035  *
0036  */
0037 T.Control
0038 {
0039     id: control
0040     Maui.Theme.backgroundColor: isSection ? "transparent" : (index % 2 === 0 ? Qt.darker(Maui.Theme.backgroundColor) : "transparent")
0041     implicitHeight: Maui.Style.rowHeight + topPadding + bottomPadding
0042     
0043     
0044     focusPolicy: Qt.NoFocus
0045     hoverEnabled: false
0046     
0047     padding: Maui.Style.defaultPadding
0048     spacing: Maui.Style.defaultSpacing
0049     
0050     //   highlighted:  ListView.isCurrentItem
0051     /**
0052    * isCurrentListItem : bool
0053    */
0054     //property alias isCurrentListItem : control.highlighted
0055 
0056     /**
0057    * isSection : bool
0058    */
0059     property bool isSection : false
0060 
0061     /**
0062    * label : string
0063    */
0064     property alias label: labelTxt.text
0065 
0066     /**
0067    * labelTxt : Label
0068    */
0069     property alias labelTxt : labelTxt
0070     
0071     property alias color :labelTxt.color
0072 
0073     background: Item{}
0074 
0075     contentItem: MouseArea
0076     {
0077         propagateComposedEvents: true
0078         preventStealing: false
0079         onPressed: (mouse) => mouse.accepted= false
0080 
0081         Label
0082         {
0083             anchors.fill: parent
0084             id: labelTxt
0085             font: control.isSection ? Maui.Style.h2Font : Maui.Style.defaultFont
0086             horizontalAlignment: Qt.AlignLeft
0087             verticalAlignment: Qt.AlignVCenter
0088             text: labelTxt.text
0089             elide: Text.ElideRight
0090             wrapMode: Text.NoWrap
0091             color: control.isCurrentListItem ? control.Maui.Theme.highlightedTextColor : control.Maui.Theme.textColor
0092         }
0093     }
0094 }