You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nheko/resources/qml/ui/NhekoSlider.qml

52 lines
1.5 KiB

// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15
import im.nheko 1.0
Slider {
id: control
3 years ago
property color progressColor: Nheko.colors.highlight
property bool alwaysShowSlider: true
property int sliderRadius: 16
3 years ago
value: 0
implicitHeight: sliderRadius
padding: 0
background: Rectangle {
3 years ago
x: control.leftPadding + handle.width / 2
y: control.topPadding + control.availableHeight / 2 - height / 2
implicitWidth: 200
3 years ago
implicitHeight: control.sliderRadius / 4
width: control.availableWidth - handle.width
height: implicitHeight
3 years ago
radius: height / 2
color: Nheko.colors.buttonText
Rectangle {
width: control.visualPosition * parent.width
height: parent.height
color: control.progressColor
radius: 2
}
3 years ago
}
handle: Rectangle {
x: control.leftPadding + control.visualPosition * background.width
y: control.topPadding + control.availableHeight / 2 - height / 2
implicitWidth: control.sliderRadius
implicitHeight: control.sliderRadius
3 years ago
radius: control.sliderRadius / 2
color: control.progressColor
visible: Settings.mobileMode || control.alwaysShowSlider || control.hovered || control.pressed
border.color: control.progressColor
}
3 years ago
}