Warning, /maui/mauikit/src/controls.5/TabButton.qml is written in an unsupported language. File is not indexed.
0001
0002 import QtQuick 2.15
0003 import QtQuick.Controls 2.15
0004 import QtQuick.Layouts 1.3
0005 import QtQuick.Templates 2.15 as T
0006
0007 import org.mauikit.controls 1.3 as Maui
0008
0009 /**
0010 * TabButton
0011 * A global sidebar for the application window that can be collapsed.
0012 *
0013 *
0014 *
0015 *
0016 *
0017 *
0018 */
0019 T.TabButton
0020 {
0021 id: control
0022
0023 opacity: enabled ? 1 : 0.5
0024
0025 implicitWidth: implicitContentWidth + leftPadding + rightPadding
0026 implicitHeight: implicitContentHeight + topPadding + bottomPadding
0027
0028 hoverEnabled: !Maui.Handy.isMobile
0029
0030 padding: Maui.Style.defaultPadding
0031 spacing: Maui.Style.space.small
0032
0033 font: Maui.Style.defaultFont
0034
0035 icon.width: Maui.Style.iconSize
0036 icon.height: Maui.Style.iconSize
0037
0038 Maui.Theme.colorSet: Maui.Theme.Button
0039 Maui.Theme.inherit: false
0040
0041 property alias content: _content.data
0042 property alias leftContent: _leftContent.data
0043 property alias rightContent: _rightContent.data
0044
0045 property bool closeButtonVisible: true
0046
0047 /**
0048 * closeClicked :
0049 */
0050 signal closeClicked()
0051 signal rightClicked(var mouse)
0052
0053 background: Rectangle
0054 {
0055 color: control.checked ? Maui.Theme.backgroundColor : (control.hovered || control.pressed ? Maui.Theme.hoverColor : "transparent")
0056 radius: Maui.Style.radiusV
0057 }
0058
0059 contentItem: MouseArea
0060 {
0061 implicitWidth: _content.implicitWidth
0062 implicitHeight: _content.implicitHeight
0063
0064 acceptedButtons: Qt.RightButton
0065 propagateComposedEvents: true
0066 preventStealing: false
0067
0068 onClicked:
0069 {
0070 if(mouse.button === Qt.RightButton)
0071 {
0072 control.rightClicked(mouse)
0073 }
0074
0075 mouse.accepted = false
0076 }
0077
0078 RowLayout
0079 {
0080 id: _content
0081 anchors.fill: parent
0082 spacing: control.spacing
0083
0084 Row
0085 {
0086 id: _leftContent
0087 }
0088
0089 Maui.IconLabel
0090 {
0091 Layout.fillWidth: true
0092 Layout.fillHeight: true
0093 opacity: control.checked || control.hovered ? 1 : 0.7
0094
0095 text: control.text
0096 icon: control.icon
0097 color: Maui.Theme.textColor
0098 alignment: Qt.AlignHCenter
0099 display: ToolButton.TextBesideIcon
0100 font: control.font
0101 }
0102
0103 Row
0104 {
0105 id: _rightContent
0106 }
0107
0108 Loader
0109 {
0110 asynchronous: true
0111 active: control.closeButtonVisible
0112
0113 Layout.alignment: Qt.AlignCenter
0114
0115 sourceComponent: Maui.CloseButton
0116 {
0117 opacity: Maui.Handy.isMobile ? 1 : (control.hovered || control.checked ? 1 : 0)
0118 padding: 0
0119
0120 implicitHeight: 16
0121 implicitWidth: 16
0122
0123 icon.width: 16
0124 icon.height: 16
0125
0126 onClicked: control.closeClicked()
0127
0128 Behavior on opacity
0129 {
0130 NumberAnimation
0131 {
0132 duration: Maui.Style.units.longDuration
0133 easing.type: Easing.InOutQuad
0134 }
0135 }
0136 }
0137 }
0138 }
0139 }
0140 }
0141