Warning, /rolisteam/rolisteam/src/libraries/qml_views/rolistyle/Switch.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.15
0002 import QtQuick.Templates 2.15 as T
0003 import QtQuick.Controls 2.15
0004 import QtQuick.Controls.impl 2.15
0005 import Customization 1.0
0006 
0007 T.Switch {
0008     id: control
0009     property QtObject style: Theme.styleSheet("Palette")
0010 
0011     implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0012                             implicitContentWidth + leftPadding + rightPadding)
0013     implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0014                              implicitContentHeight + topPadding + bottomPadding,
0015                              implicitIndicatorHeight + topPadding + bottomPadding)
0016 
0017     padding: 6
0018     spacing: 6
0019 
0020     indicator: PaddedRectangle {
0021         implicitWidth: 56
0022         implicitHeight: 28
0023 
0024         x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
0025         y: control.topPadding + (control.availableHeight - height) / 2
0026 
0027         radius: 8
0028         leftPadding: 0
0029         rightPadding: 0
0030         padding: (height - 16) / 2
0031         color: control.checked ? control.style.checked : control.style.axis
0032 
0033 
0034         Rectangle {
0035             x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2)))
0036             y: (parent.height - height) / 2
0037             width: 28
0038             height: 28
0039             radius: 16
0040             //color: control.down ? control.palette.light : control.palette.window
0041             color: control.down ? control.style.light : control.style.window
0042             border.width: control.visualFocus ? 2 : 1
0043             //border.color: control.visualFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight
0044             border.color: control.visualFocus ? control.style.highlight : control.enabled ? control.style.mid : control.style.midlight
0045 
0046             Behavior on x {
0047                 enabled: !control.down
0048                 SmoothedAnimation { velocity: 200 }
0049             }
0050         }
0051     }
0052 
0053     contentItem: CheckLabel {
0054         leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
0055         rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
0056 
0057         text: control.text
0058         font: control.font
0059         color: control.style.text
0060     }
0061 }
0062