Warning, /maui/nomad-style/Switch.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2017 Marco Martin <mart@kde.org>
0003 * Copyright 2017 The Qt Company Ltd.
0004 *
0005 * GNU Lesser General Public License Usage
0006 * Alternatively, this file may be used under the terms of the GNU Lesser
0007 * General Public License version 3 as published by the Free Software
0008 * Foundation and appearing in the file LICENSE.LGPLv3 included in the
0009 * packaging of this file. Please review the following information to
0010 * ensure the GNU Lesser General Public License version 3 requirements
0011 * will be met: https://www.gnu.org/licenses/lgpl.html.
0012 *
0013 * GNU General Public License Usage
0014 * Alternatively, this file may be used under the terms of the GNU
0015 * General Public License version 2.0 or later as published by the Free
0016 * Software Foundation and appearing in the file LICENSE.GPL included in
0017 * the packaging of this file. Please review the following information to
0018 * ensure the GNU General Public License version 2.0 requirements will be
0019 * met: http://www.gnu.org/licenses/gpl-2.0.html.
0020 */
0021
0022
0023 import QtQuick 2.6
0024 import QtQuick.Templates 2.3 as T
0025 import org.kde.kirigami 2.2 as Kirigami
0026
0027 T.CheckBox {
0028 id: control
0029
0030 implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
0031 implicitHeight: Math.max(contentItem.implicitHeight,
0032 indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
0033 baselineOffset: contentItem.y + contentItem.baselineOffset
0034
0035 padding: 1
0036 spacing: Kirigami.Units.smallSpacing
0037
0038 hoverEnabled: true
0039
0040 indicator: SwitchIndicator {
0041 LayoutMirroring.enabled: control.mirrored
0042 LayoutMirroring.childrenInherit: true
0043 height: 22
0044 anchors {
0045 left: parent.left
0046 verticalCenter: parent.verticalCenter
0047 }
0048 control: control
0049 }
0050
0051 contentItem: Label {
0052 leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
0053 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
0054 opacity: control.enabled ? 1 : 0.6
0055 text: control.text
0056 font: control.font
0057 color: Kirigami.Theme.textColor
0058 elide: Text.ElideRight
0059 visible: control.text
0060 horizontalAlignment: Text.AlignLeft
0061 verticalAlignment: Text.AlignVCenter
0062 }
0063 }