Warning, /maui/mauikit/src/style.5/SwitchIndicator.qml is written in an unsupported language. File is not indexed.

0001 /****************************************************************************
0002  * *
0003  ** Copyright (C) 2017 The Qt Company Ltd.
0004  ** Contact: http://www.qt.io/licensing/
0005  **
0006  ** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
0007  **
0008  ** $QT_BEGIN_LICENSE:LGPL3$
0009  ** Commercial License Usage
0010  ** Licensees holding valid commercial Qt licenses may use this file in
0011  ** accordance with the commercial license agreement provided with the
0012  ** Software or, alternatively, in accordance with the terms contained in
0013  ** a written agreement between you and The Qt Company. For licensing terms
0014  ** and conditions see http://www.qt.io/terms-conditions. For further
0015  ** information use the contact form at http://www.qt.io/contact-us.
0016  **
0017  ** GNU Lesser General Public License Usage
0018  ** Alternatively, this file may be used under the terms of the GNU Lesser
0019  ** General Public License version 3 as published by the Free Software
0020  ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
0021  ** packaging of this file. Please review the following information to
0022  ** ensure the GNU Lesser General Public License version 3 requirements
0023  ** will be met: https://www.gnu.org/licenses/lgpl.html.
0024  **
0025  ** GNU General Public License Usage
0026  ** Alternatively, this file may be used under the terms of the GNU
0027  ** General Public License version 2.0 or later as published by the Free
0028  ** Software Foundation and appearing in the file LICENSE.GPL included in
0029  ** the packaging of this file. Please review the following information to
0030  ** ensure the GNU General Public License version 2.0 requirements will be
0031  ** met: http://www.gnu.org/licenses/gpl-2.0.html.
0032  **
0033  ** $QT_END_LICENSE$
0034  **
0035  ****************************************************************************/
0036 
0037 import QtQuick 2.15
0038 import org.mauikit.controls 1.3 as Maui
0039 
0040 Item
0041 {
0042     id: indicator
0043     
0044     implicitWidth: height * 1.8
0045     implicitHeight: 22
0046     
0047     property Item control
0048     property alias handle: handle
0049     property color m_color : control.checked ? Maui.Theme.highlightColor : (control.hovered ? Maui.Theme.hoverColor :  Maui.ColorUtils.linearInterpolation(Maui.Theme.alternateBackgroundColor, Maui.Theme.textColor, 0.2))
0050     
0051     Rectangle
0052     {
0053         width: parent.width
0054         height: parent.height
0055         radius: Maui.Style.radiusV
0056         color:  m_color
0057 //         opacity: control.checked ? 1 : 0.5
0058         
0059         Behavior on color
0060         {
0061             Maui.ColorTransition{}
0062         }
0063         
0064         Behavior on opacity
0065         {
0066             NumberAnimation
0067             {
0068                 easing.type: Easing.InQuad
0069                 duration: Maui.Style.units.shortDuration
0070             }
0071         }
0072     }
0073     
0074     Rectangle
0075     {
0076         id: handle
0077         x: control.visualPosition * parent.width >= parent.width ? control.visualPosition * parent.width - (width + 2) : control.visualPosition * parent.width + 2
0078         y: (parent.height - height) / 2
0079         width: height
0080         height: parent.height - 4
0081         radius: Maui.Style.radiusV
0082         color: Maui.Theme.backgroundColor      
0083         
0084         Behavior on x
0085         {
0086             enabled: !control.pressed
0087             SmoothedAnimation
0088             {
0089                 duration: 300
0090             }
0091         }
0092         
0093         Behavior on color
0094         {
0095             Maui.ColorTransition{}
0096         }
0097     }
0098 }