summaryrefslogtreecommitdiffstats
path: root/tests/manual/pointlinesize/main.qml
blob: 6326bfecd511ebde7b1274b2ce926df3d2223890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.0
import QtQuick.Scene3D 2.0

import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Item {
    id: root

    Scene3D {
        anchors.fill: parent
        focus: true
        aspects: ["input", "logic", "render"]
        cameraAspectRatioMode: Scene3D.AutomaticAspectRatio

        Scene {
            id: scene
            width : root.lineWidth
        }
    }

    property real wMin : 0.5
    property real wMax : 64.0
    property real lineWidth : wMin * Math.exp(Math.log(wMax / wMin) * slider.value)

    Text {
        id: sliderLabel
        anchors.top: parent.top
        anchors.right: parent.right
        anchors.margins: 20
        font.pixelSize: 20
        color: "white"
        text: "width = " + lineWidth.toFixed(2)
    }

    Slider {
        id: slider
        anchors.top: sliderLabel.bottom
        anchors.right: parent.right
        anchors.margins: 20
        width: 200
        value: 0.0
    }

    Text {
        anchors.top: slider.bottom
        anchors.right: parent.right
        anchors.margins: 20
        color: scene.smooth ? "white" : "lightgray"
        text: scene.smooth ? "Line Smoothing enabled" : "Line Smoothing disabled"
        font.pixelSize: 20
        MouseArea {
            anchors.fill: parent
            onClicked: scene.smooth = !scene.smooth
        }
    }
}