Skip to content
Snippets Groups Projects
Commit a6e7fd37 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

split views

parent 9a9d4d3c
No related branches found
No related tags found
No related merge requests found
......@@ -14,205 +14,150 @@ Window {
visible: true
title: qsTr("Hello World")
RowLayout {
anchors.fill: parent
component TickRectangle: Rectangle {
width: 100
height: 100
color: redButton.checked ? "red" : "lightgray"
Text {
anchors.centerIn: parent
text: root.tick
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
component OffScreenTickRectangle: TickRectangle {
color: redButton.checked ? "red" : "lightcyan"
layer.enabled: true
}
Item {
anchors.centerIn: parent
component ShaderEffectSourceTickRectangle: ShaderEffectSource {
width: 100
height: 100
sourceItem: TickRectangle {
color: redButton.checked ? "red" : "lightblue"
}
}
Rectangle {
x: -120 - width / 2
y: -height / 2
width: 100
height: 100
color: "lightgray"
component SimpleView3D: View3D {
width: 100
height: 100
Text {
anchors.centerIn: parent
text: root.tick
}
}
OrthographicCamera {
position: Qt.vector3d(0, 0, 100)
}
ShaderEffectSource {
x: 120 - width / 2
y: -height / 2
width: 100
height: 100
sourceItem: Rectangle {
width: 100
height: 100
color: "lightblue"
Text {
anchors.centerIn: parent
text: root.tick
}
}
}
DirectionalLight {
position: Qt.vector3d(0, 0, 100)
brightness: 100
}
Model {
position: Qt.vector3d(0, 0, 0)
scale: Qt.vector3d(0.2, 0.2, 0.2)
source: "#Sphere"
opacity: 0.1
materials: DefaultMaterial {
diffuseColor: "blue"
}
}
}
component RectangleModel: Model {
property alias sourceItem: texture.sourceItem
source: "#Rectangle"
materials: DefaultMaterial {
lighting: DefaultMaterial.NoLighting
diffuseMap: Texture {
id: texture
}
}
}
ColumnLayout {
anchors.fill: parent
anchors.margins: 10
spacing: 10
RowLayout {
Layout.fillWidth: true
spacing: 10
CheckBox {
id: timerRunning
text: "Running"
checked: true
}
Button {
id: redButton
text: "Red"
checkable: true
}
}
View3D {
GridLayout {
Layout.fillWidth: true
Layout.fillHeight: true
columnSpacing: 20
rowSpacing: 20
columns: 3
OrthographicCamera {
position: Qt.vector3d(0, 0, 100)
TickRectangle {
}
DirectionalLight {
position: Qt.vector3d(0, 0, 100)
brightness: 100
OffScreenTickRectangle {
}
Node {
position: Qt.vector3d(-120, 0, 0)
Rectangle {
anchors.centerIn: parent // default of Qt 5
width: 100
height: 100
color: "lightgray"
Text {
anchors.centerIn: parent
text: root.tick
}
}
ShaderEffectSourceTickRectangle {
}
Node {
position: Qt.vector3d(0, 0, 0)
Rectangle {
anchors.centerIn: parent // default of Qt 5
width: 100
height: 100
color: "lightcyan"
layer.enabled: true
Text {
anchors.centerIn: parent
text: root.tick
SimpleView3D {
Node {
TickRectangle {
anchors.centerIn: parent // default of Qt 5
}
}
}
Node {
position: Qt.vector3d(120, 0, 0)
ShaderEffectSource {
anchors.centerIn: parent // default of Qt 5
width: 100
height: 100
sourceItem: Rectangle {
width: 100
height: 100
color: "lightblue"
Text {
anchors.centerIn: parent
text: root.tick
}
SimpleView3D {
Node {
OffScreenTickRectangle {
anchors.centerIn: parent // default of Qt 5
}
}
}
Model {
position: Qt.vector3d(-120, -120, 0)
source: "#Rectangle"
materials: DefaultMaterial {
lighting: DefaultMaterial.NoLighting
diffuseMap: Texture {
sourceItem: Rectangle {
width: 100
height: 100
color: redButton.checked ? "red" : "lightgray"
Text {
anchors.centerIn: parent
text: root.tick
}
}
SimpleView3D {
Node {
ShaderEffectSourceTickRectangle {
anchors.centerIn: parent // default of Qt 5
}
}
}
Model {
position: Qt.vector3d(0, -120, 0)
source: "#Rectangle"
materials: DefaultMaterial {
lighting: DefaultMaterial.NoLighting
diffuseMap: Texture {
sourceItem: Rectangle {
width: 100
height: 100
color: redButton.checked ? "red" : "lightcyan"
layer.enabled: true
Text {
anchors.centerIn: parent
text: root.tick
}
}
SimpleView3D {
RectangleModel {
sourceItem: TickRectangle {
}
}
}
Model {
position: Qt.vector3d(120, -120, 0)
source: "#Rectangle"
materials: DefaultMaterial {
lighting: DefaultMaterial.NoLighting
diffuseMap: Texture {
sourceItem: ShaderEffectSource {
width: 100
height: 100
sourceItem: Rectangle {
width: 100
height: 100
color: redButton.checked ? "red" : "lightblue"
layer.enabled: true
Text {
anchors.centerIn: parent
text: root.tick
}
}
}
SimpleView3D {
RectangleModel {
sourceItem: OffScreenTickRectangle {
}
}
}
Model {
position: Qt.vector3d(0, 0, 10)
scale: Qt.vector3d(0.2, 0.2, 0.2)
source: "#Sphere"
opacity: 0.1
materials: DefaultMaterial {
diffuseColor: "blue"
SimpleView3D {
RectangleModel {
sourceItem: ShaderEffectSourceTickRectangle {
}
}
}
}
}
RowLayout {
spacing: 10
CheckBox {
id: timerRunning
text: "Running"
checked: true
}
Button {
id: redButton
text: "Red"
checkable: true
}
}
Timer {
interval: 1000
repeat: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment