summaryrefslogtreecommitdiffstats
path: root/tests/manual/qmlclient/main.qml
blob: c7cb81498a2a33083d31d17c1840ae01fcfa444c (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
61
62
63
64
65
66
67
68
// Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick 2.2
import QtQuick.Window 2.2

Window {
    id: window
    width: 400
    height: 400
    color: "blue"
    visible: true

    Column {
        spacing: 8

        Row {
            spacing: 8

            Repeater {
                model: ListModel {
                    ListElement { label: "Windowed"; value: Window.Windowed }
                    ListElement { label: "Maximized"; value: Window.Maximized }
                    ListElement { label: "FullScreen"; value: Window.FullScreen }
                }

                Rectangle {
                    width: 96
                    height: 40
                    color: "gainsboro"

                    MouseArea {
                        anchors.fill: parent
                        onClicked: window.visibility = model.value

                        Text {
                            anchors.centerIn: parent
                            text: model.label
                        }
                    }
                }
            }
        }

        Text {
            color: "white"
            text: {
                switch (window.visibility) {
                case Window.Windowed:
                    return "windowed";
                case Window.Maximized:
                    return "maximized";
                case Window.FullScreen:
                    return "fullscreen";
                case Window.Minimized:
                    return "minimized";
                case Window.AutomaticVisibility:
                    return "automatic";
                case Window.Hidden:
                    return "hidden";
                default:
                    break;
                }
                return "unknown";
            }
        }
    }
}