C++ / fmt (pull_request) Successful in 4s
C++ / build (pull_request) Successful in 2m7s
JS/TS / fmt (pull_request) Successful in 14s
JS/TS / lint (pull_request) Successful in 16s
C++ / clang-tidy (pull_request) Successful in 3m34s
Python / static (pull_request) Successful in 1m0s
Rust / build (pull_request) Successful in 1m5s
Rust / fmt (pull_request) Successful in 34s
Python / verify (pull_request) Successful in 1m58s
Rust / clippy (pull_request) Successful in 46s
75 lines
1.7 KiB
QML
75 lines
1.7 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import ZShell.Config
|
|
import qs.Services
|
|
import qs.Components
|
|
import qs.Modules.Settings.Common
|
|
|
|
CustomSwitch {
|
|
id: toggleItem
|
|
|
|
readonly property alias bg: bg
|
|
property alias first: bg.first
|
|
property alias last: bg.last
|
|
property string subtext
|
|
|
|
Layout.fillWidth: true
|
|
cLayer: 2
|
|
horizontalPadding: Tokens.padding.largeIncreased
|
|
implicitHeight: Math.max(implicitContentHeight, implicitIndicatorHeight) + verticalPadding * 2
|
|
implicitWidth: implicitContentWidth + implicitIndicatorWidth + horizontalPadding * 2
|
|
indicator.anchors.right: right
|
|
indicator.anchors.rightMargin: toggleItem.horizontalPadding
|
|
indicator.anchors.verticalCenter: verticalCenter
|
|
verticalPadding: Tokens.padding.normal
|
|
|
|
background: ConnectedRect {
|
|
id: bg
|
|
|
|
StateLayer {
|
|
id: stateLayer
|
|
|
|
manualPressOverride: toggleItem.pressed
|
|
}
|
|
}
|
|
contentItem: Item {
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: toggleItem.horizontalPadding
|
|
anchors.right: toggleItem.indicator.left
|
|
anchors.rightMargin: Tokens.spacing.normal
|
|
implicitHeight: column.implicitHeight
|
|
implicitWidth: column.implicitWidth
|
|
|
|
ColumnLayout {
|
|
id: column
|
|
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 0
|
|
|
|
CustomText {
|
|
id: label
|
|
|
|
Layout.fillWidth: true
|
|
elide: Text.ElideRight
|
|
font.pointSize: Tokens.font.size.smaller
|
|
text: toggleItem.text
|
|
}
|
|
|
|
CustomText {
|
|
id: subtext
|
|
|
|
Layout.fillWidth: true
|
|
color: Colors.palette.m3outline
|
|
elide: Text.ElideRight
|
|
font.pointSize: Tokens.font.size.small
|
|
text: toggleItem.subtext
|
|
visible: toggleItem.subtext
|
|
}
|
|
}
|
|
}
|
|
|
|
onPressed: stateLayer.press(stateLayer.mouseX, stateLayer.mouseY)
|
|
}
|