|
| 1 | +import "../Constants" |
| 2 | +import QtQuick |
| 3 | +import QtQuick.Controls.Material |
| 4 | +import QtQuick.Controls.Material.impl |
| 5 | +import QtQuick.Controls.impl |
| 6 | +import QtQuick.Templates as T |
| 7 | + |
| 8 | +T.TabButton { |
| 9 | + id: control |
| 10 | + |
| 11 | + property color labelColor: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? Constants.swiftWhite : Constants.tabButtonUnselectedTextColor |
| 12 | + property color gradientStartColor: down || checked ? Qt.lighter(Constants.swiftGrey, 1.7) : hovered ? Qt.lighter(Constants.swiftControlBackground, 1.1) : Constants.swiftWhite |
| 13 | + property color backgroundColor: down || checked ? Constants.swiftGrey : hovered ? Qt.darker(Constants.swiftControlBackground, 1.1) : Constants.swiftControlBackground |
| 14 | + property bool border: true |
| 15 | + |
| 16 | + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) |
| 17 | + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) |
| 18 | + padding: 12 |
| 19 | + spacing: 6 |
| 20 | + icon.width: 24 |
| 21 | + icon.height: 24 |
| 22 | + icon.color: !enabled ? Material.hintTextColor : down || checked ? Constants.swiftWhite : Constants.tabButtonUnselectedTextColor |
| 23 | + |
| 24 | + font { |
| 25 | + family: "Roboto" |
| 26 | + pixelSize: Constants.largePixelSize |
| 27 | + bold: true |
| 28 | + capitalization: Font.MixedCase |
| 29 | + } |
| 30 | + |
| 31 | + contentItem: IconLabel { |
| 32 | + spacing: control.spacing |
| 33 | + mirrored: control.mirrored |
| 34 | + display: control.display |
| 35 | + icon: control.icon |
| 36 | + text: control.text |
| 37 | + font: control.font |
| 38 | + color: control.labelColor |
| 39 | + } |
| 40 | + |
| 41 | + background: Rectangle { |
| 42 | + border.width: control.border ? 1 : 0 |
| 43 | + border.color: Constants.spacerColor |
| 44 | + implicitHeight: control.Material.touchTarget |
| 45 | + clip: true |
| 46 | + color: backgroundColor |
| 47 | + |
| 48 | + gradient: Gradient { |
| 49 | + GradientStop { |
| 50 | + position: 0 |
| 51 | + color: gradientStartColor |
| 52 | + } |
| 53 | + |
| 54 | + GradientStop { |
| 55 | + position: 1 |
| 56 | + color: backgroundColor |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | +} |
0 commit comments