blob: e08e19801f187e23389a37c73da6a7ce0daaf27c (
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Layouts
import MyStyle
ApplicationWindow {
width: 800
height: 600
title: qsTr("Attached Objects")
visible: true
MyStyle.theme: darkModeSwitch.checked ? MyStyle.Dark : MyStyle.Light
header: ToolBar {
MyStyle.theme: MyStyle.Dark
RowLayout {
anchors.fill: parent
anchors.leftMargin: 12
Label {
text: qsTr("This is a Label in a ToolBar")
}
Item {
Layout.fillWidth: true
}
Switch {
id: darkModeSwitch
text: qsTr("Dark mode")
}
}
}
ColumnLayout {
anchors.centerIn: parent
spacing: 20
Label {
text: qsTr("This is a Label in an ApplicationWindow")
Layout.alignment: Qt.AlignHCenter
}
RowLayout {
Button {
text: qsTr("Open Popup")
onClicked: popup.open()
}
Button {
text: qsTr("Open Window")
onClicked: {
if (!childWindow.active)
childWindow.show()
else
childWindow.raise()
}
}
}
}
Popup {
id: popup
dim: true
anchors.centerIn: parent
ColumnLayout {
anchors.centerIn: parent
spacing: 20
Label {
text: qsTr("This is a Label in a Popup")
Layout.alignment: Qt.AlignHCenter
}
Button {
text: qsTr("Close Popup")
Layout.alignment: Qt.AlignHCenter
onClicked: popup.close()
}
}
}
ApplicationWindow {
id: childWindow
width: 600
height: 400
title: qsTr("Attached Objects - Child Window")
ColumnLayout {
anchors.centerIn: parent
spacing: 20
Label {
text: qsTr("This is a Label in a child ApplicationWindow")
Layout.alignment: Qt.AlignHCenter
}
Button {
text: qsTr("Close Window")
Layout.alignment: Qt.AlignHCenter
onClicked: childWindow.close()
}
}
}
}
|