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

0001 /****************************************************************************
0002  * *
0003  ** Copyright (C) 2017 The Qt Company Ltd.
0004  ** Contact: http://www.qt.io/licensing/
0005  **
0006  ** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
0007  **
0008  ** $QT_BEGIN_LICENSE:LGPL3$
0009  ** Commercial License Usage
0010  ** Licensees holding valid commercial Qt licenses may use this file in
0011  ** accordance with the commercial license agreement provided with the
0012  ** Software or, alternatively, in accordance with the terms contained in
0013  ** a written agreement between you and The Qt Company. For licensing terms
0014  ** and conditions see http://www.qt.io/terms-conditions. For further
0015  ** information use the contact form at http://www.qt.io/contact-us.
0016  **
0017  ** GNU Lesser General Public License Usage
0018  ** Alternatively, this file may be used under the terms of the GNU Lesser
0019  ** General Public License version 3 as published by the Free Software
0020  ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
0021  ** packaging of this file. Please review the following information to
0022  ** ensure the GNU Lesser General Public License version 3 requirements
0023  ** will be met: https://www.gnu.org/licenses/lgpl.html.
0024  **
0025  ** GNU General Public License Usage
0026  ** Alternatively, this file may be used under the terms of the GNU
0027  ** General Public License version 2.0 or later as published by the Free
0028  ** Software Foundation and appearing in the file LICENSE.GPL included in
0029  ** the packaging of this file. Please review the following information to
0030  ** ensure the GNU General Public License version 2.0 requirements will be
0031  ** met: http://www.gnu.org/licenses/gpl-2.0.html.
0032  **
0033  ** $QT_END_LICENSE$
0034  **
0035  ****************************************************************************/
0036 
0037 import QtQuick 2.15
0038 import QtQuick.Templates 2.15 as T
0039 
0040 import org.mauikit.controls 1.3 as Maui
0041 
0042 T.ToolButton
0043 {
0044     id: control
0045     
0046     Maui.Theme.colorSet:  Maui.Theme.Button
0047     Maui.Theme.inherit: false
0048     
0049     property bool subMenu : false
0050     
0051     opacity: enabled ? 1 : 0.5
0052        
0053     implicitWidth: Math.max(implicitContentWidth + leftPadding + rightPadding, implicitHeight)    
0054     implicitHeight: implicitContentHeight + topPadding + bottomPadding
0055     
0056     hoverEnabled: !Maui.Handy.isMobile
0057     
0058     padding: Maui.Style.defaultPadding
0059     spacing: Maui.Style.space.small   
0060     
0061     icon.width: Maui.Style.iconSize
0062     icon.height: Maui.Style.iconSize
0063     
0064     icon.color: control.color
0065     
0066     readonly property color color : control.down || control.checked ? (control.flat ? Maui.Theme.highlightColor : Maui.Theme.highlightedTextColor) : Maui.Theme.textColor
0067     
0068     flat: control.parent === T.ToolBar
0069     font: Maui.Style.defaultFont    
0070     
0071     indicator: Maui.Icon
0072     {
0073         x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding 
0074         y: control.topPadding + (control.availableHeight - height) / 2
0075         
0076         visible: control.subMenu
0077         color: control.color
0078         height: 8
0079         width: 8
0080         source: "qrc:/assets/arrow-down.svg"
0081     }
0082     
0083     contentItem: Maui.IconLabel
0084     {
0085         readonly property real arrowPadding: control.subMenu && control.indicator ? control.indicator.width + Maui.Style.space.tiny : 0
0086         
0087         rightPadding: arrowPadding 
0088                 
0089         spacing: control.spacing
0090         // mirrored: control.mirrored
0091         display: control.display
0092         
0093         icon: control.icon
0094         text: control.text
0095         font: control.font
0096         alignment: Qt.AlignHCenter
0097         color: control.color
0098     }
0099     
0100 //     Behavior on implicitHeight
0101 //     {
0102 //         NumberAnimation
0103 //         {
0104 //             duration: Maui.Style.units.shortDuration
0105 //             easing.type: Easing.InQuad
0106 //         }
0107 //     }
0108 //     
0109 //     Behavior on implicitWidth
0110 //     {
0111 //         NumberAnimation
0112 //         {
0113 //             duration: Maui.Style.units.shortDuration
0114 //             easing.type: Easing.InQuad
0115 //         }
0116 //     }
0117     
0118     ToolTip.delay: 1000
0119     ToolTip.timeout: 5000
0120     ToolTip.visible: control.hovered && control.text.length && (control.display === ToolButton.IconOnly ? true : !checked)
0121     ToolTip.text: control.text
0122     
0123     background: Rectangle
0124     {
0125         visible: !control.flat
0126                 radius: Maui.Style.radiusV
0127         
0128         color: control.pressed || control.down || control.checked ? control.Maui.Theme.highlightColor : (control.highlighted || control.hovered ? control.Maui.Theme.hoverColor : "transparent")        
0129     }
0130 }