| 1 |
// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick 2.0 |
| 5 |
import QtQuick.Scene3D 2.0 |
| 6 |
|
| 7 |
import QtQuick.Controls 1.4 |
| 8 |
import QtQuick.Controls.Styles 1.4 |
| 9 |
|
| 10 |
Item { |
| 11 |
id: root |
| 12 |
|
| 13 |
Scene3D { |
| 14 |
anchors.fill: parent |
| 15 |
focus: true |
| 16 |
aspects: ["input", "logic", "render"] |
| 17 |
cameraAspectRatioMode: Scene3D.AutomaticAspectRatio |
| 18 |
|
| 19 |
Scene { |
| 20 |
id: scene |
| 21 |
width : root.lineWidth |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
property real wMin : 0.5 |
| 26 |
property real wMax : 64.0 |
| 27 |
property real lineWidth : wMin * Math.exp(Math.log(wMax / wMin) * slider.value) |
| 28 |
|
| 29 |
Text { |
| 30 |
id: sliderLabel |
| 31 |
anchors.top: parent.top |
| 32 |
anchors.right: parent.right |
| 33 |
anchors.margins: 20 |
| 34 |
font.pixelSize: 20 |
| 35 |
color: "white" |
| 36 |
text: "width = " + lineWidth.toFixed(2) |
| 37 |
} |
| 38 |
|
| 39 |
Slider { |
| 40 |
id: slider |
| 41 |
anchors.top: sliderLabel.bottom |
| 42 |
anchors.right: parent.right |
| 43 |
anchors.margins: 20 |
| 44 |
width: 200 |
| 45 |
value: 0.0 |
| 46 |
} |
| 47 |
|
| 48 |
Text { |
| 49 |
anchors.top: slider.bottom |
| 50 |
anchors.right: parent.right |
| 51 |
anchors.margins: 20 |
| 52 |
color: scene.smooth ? "white" : "lightgray" |
| 53 |
text: scene.smooth ? "Line Smoothing enabled" : "Line Smoothing disabled" |
| 54 |
font.pixelSize: 20 |
| 55 |
MouseArea { |
| 56 |
anchors.fill: parent |
| 57 |
onClicked: scene.smooth = !scene.smooth |
| 58 |
} |
| 59 |
} |
| 60 |
} |