Warning, /graphics/krita/plugins/dockers/throttle/qml/slider.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-License-Identifier: GPL-3.0-or-later 0003 */ 0004 0005 import QtQuick 2.2 0006 Rectangle { 0007 color: "#545454" 0008 0009 Text { 0010 id: numberOfCores 0011 font.family: "Helvetica" 0012 font.pointSize: 52 0013 anchors.centerIn: parent 0014 text: ThreadManager.threadCount 0015 } 0016 0017 Rectangle { 0018 id: container 0019 property int oldWidth: 0 0020 anchors { bottom: parent.bottom; left: parent.left 0021 right: parent.right; leftMargin: 20; rightMargin: 20 0022 bottomMargin: 10 0023 } 0024 height: 16 0025 0026 radius: 8 0027 opacity: 0.7 0028 antialiasing: true 0029 gradient: Gradient { 0030 GradientStop { position: 0.0; color: "gray" } 0031 GradientStop { position: 1.0; color: "white" } 0032 } 0033 0034 onWidthChanged: { 0035 if (oldWidth === 0) { 0036 oldWidth = width; 0037 return 0038 } 0039 0040 var desiredPercent = slider.x * 100 / (oldWidth - 32) 0041 slider.x = desiredPercent * (width - 32) / 100 0042 oldWidth = width 0043 } 0044 0045 Rectangle { 0046 id: slider 0047 x: container.width - 32; y: 1; width: 30; height: 14 0048 radius: 6 0049 antialiasing: true 0050 gradient: Gradient { 0051 GradientStop { position: 0.0; color: "#424242" } 0052 GradientStop { position: 1.0; color: "black" } 0053 } 0054 0055 MouseArea { 0056 anchors.fill: parent 0057 anchors.margins: -16 // Increase mouse area a lot outside the slider 0058 drag.target: parent; drag.axis: Drag.XAxis 0059 drag.minimumX: 2; drag.maximumX: container.width - 32 0060 } 0061 0062 onXChanged: { 0063 ThreadManager.threadCount = slider.x * 100 / (container.width - 32) 0064 } 0065 } 0066 } 0067 }