// SPDX-License-Identifier: GPL-3.0-or-later /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2013 - 2024, nymea GmbH * Copyright (C) 2024 - 2025, chargebyte austria GmbH * * This file is part of nymea-app-energy-overlay. * * nymea-app-energy-overlay is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * nymea-app-energy-overlay is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License * along with nymea-app-energy-overlay. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ import QtQuick import QtQuick.Templates as T import QtQuick.Controls import QtQuick.Controls.impl import QtQuick.Controls.Material import QtQuick.Controls.Material.impl import Nymea T.Slider { id: control implicitWidth: background.implicitWidth + leftInset + rightInset implicitHeight: background.implicitHeight + topInset + bottomInset padding: 6 handle: SliderHandle { x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) value: control.value height: 16 width: 16 handleHasFocus: control.visualFocus handlePressed: control.pressed handleHovered: control.hovered } background: Rectangle { x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2) y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0) implicitWidth: control.horizontal ? 200 : 48 implicitHeight: control.horizontal ? 48 : 200 width: control.horizontal ? control.availableWidth : 4 height: control.horizontal ? 16 : control.availableHeight scale: control.horizontal && control.mirrored ? -1 : 1 color: control.enabled ? Style.white : control.Material.sliderDisabledColor radius: 8 Rectangle { x: control.horizontal ? 0 : (parent.width - width) / 2 y: control.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height width: control.horizontal ? control.position * parent.width + radius : 4 height: control.horizontal ? 16 : control.position * parent.height opacity: .3 radius: 8 color: control.enabled ? control.Material.accentColor : control.Material.sliderDisabledColor } } }