1/* 2 * Copyright (C) 2017 3 * Jean-Luc Barriere <jlbarriere68@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 3. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18import QtQuick 2.9 19import QtQuick.Controls 2.2 20 21CheckBox { 22 id: control 23 property color color: styleMusic.view.foregroundColor 24 property color controlDownColor: styleMusic.view.highlightedColor 25 property real zoom: 1.0 26 property alias textAlignment: label.horizontalAlignment 27 28 opacity: checkable ? 1.0 : 0.1 29 30 contentItem: Text { 31 id: label 32 rightPadding: control.indicator.width + control.spacing 33 //leftPadding: control.indicator.width + control.spacing 34 text: control.text 35 font: control.font 36 opacity: enabled ? 1.0 : 0.3 37 color: control.down ? control.controlDownColor : control.color 38 elide: Text.ElideRight 39 horizontalAlignment: Text.AlignLeft 40 verticalAlignment: Text.AlignVCenter 41 } 42 43 indicator: Rectangle { 44 implicitWidth: units.gu(2.5 * zoom) 45 implicitHeight: units.gu(2.5 * zoom) 46 x: control.width - width - control.rightPadding 47 //x: control.rightPadding 48 y: control.topPadding + control.availableHeight / 2 - height / 2 49 radius: units.dp(0) 50 color: "transparent" 51 border.color: control.down ? control.controlDownColor : control.color 52 53 Rectangle { 54 width: units.gu(1.5 * zoom) 55 height: units.gu(1.5 * zoom) 56 x: units.dp(4 * zoom) 57 y: units.dp(4 * zoom) 58 radius: units.dp(2 * zoom) 59 color: control.down ? control.controlDownColor : control.color 60 visible: control.checked 61 } 62 } 63} 64