Refactoring of QML states
This commit is contained in:
parent
d6233c70f0
commit
b2a458b1f2
11 changed files with 113 additions and 93 deletions
35
src/interface/modeler/quickapp/qml/AtmosphereSection.qml
Normal file
35
src/interface/modeler/quickapp/qml/AtmosphereSection.qml
Normal file
|
@ -0,0 +1,35 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
// Atmosphere control
|
||||
BaseSection {
|
||||
id: section
|
||||
|
||||
BaseToolbar {
|
||||
id: toolbar
|
||||
|
||||
ToolbarButton {
|
||||
id: tool_daytime
|
||||
selected: true
|
||||
picture: "images/icon_atmosphere_daytime.png"
|
||||
hovertext: qsTr("Change the time of day")
|
||||
}
|
||||
}
|
||||
|
||||
PanelAtmosphereDaytime {
|
||||
id: panel_daytime
|
||||
anchors.left: toolbar.right
|
||||
enabled: false
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "DayTime"
|
||||
when: tool_daytime.selected
|
||||
PropertyChanges {
|
||||
target: panel_daytime
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,26 +1,11 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
BaseRectangle {
|
||||
property ToolbarButton tool
|
||||
id: panel
|
||||
|
||||
width: 200
|
||||
height: primary_toolbar.current ? primary_toolbar.current.height : 10
|
||||
height: parent.height
|
||||
|
||||
anchors.top: parent.top
|
||||
|
||||
color: "#40909090"
|
||||
|
||||
anchors.left: primary_toolbar.current ? primary_toolbar.current.right : parent.left
|
||||
anchors.top: primary_toolbar.current ? primary_toolbar.current.top : parent.top
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "hidden"
|
||||
when: !tool.selected
|
||||
|
||||
PropertyChanges {
|
||||
target: panel
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
Toolbar {
|
||||
BaseToolbar {
|
||||
enabled: false
|
||||
height: parent.height - primary_toolbar.height
|
||||
anchors.left: primary_toolbar.left
|
||||
anchors.top: primary_toolbar.bottom
|
||||
|
||||
onEnabledChanged: primary_toolbar.current = this
|
||||
onEnabledChanged: {
|
||||
if (enabled) {
|
||||
primary_toolbar.current = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
7
src/interface/modeler/quickapp/qml/BaseSection.qml
Normal file
7
src/interface/modeler/quickapp/qml/BaseSection.qml
Normal file
|
@ -0,0 +1,7 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
BaseRectangle {
|
||||
anchors.bottom: main_ui.bottom
|
||||
height: main_ui.height - primary_toolbar.height
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ BaseRectangle {
|
|||
|
||||
default property alias children : inner_space.children
|
||||
property bool horizontal: false
|
||||
property list<BasePanel> panels
|
||||
width: horizontal ? parent.width : 60
|
||||
height: horizontal ? 60 : parent.height
|
||||
color: "#50888888"
|
||||
|
@ -15,17 +16,4 @@ BaseRectangle {
|
|||
spacing: (parent.horizontal ? (parent.width - children.length * tool_terrain.width) : (parent.height - children.length * tool_terrain.height)) / (children.length + 1)
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
onEnabledChanged: {
|
||||
if (!enabled)
|
||||
{
|
||||
for (var i = 0; i < children.length; i++)
|
||||
{
|
||||
if (!children[i].toggle)
|
||||
{
|
||||
children[i].selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
Toolbar {
|
||||
BaseToolbar {
|
||||
id: camera_choice
|
||||
horizontal: false
|
||||
color: "#90888888"
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
import QtQuick 2.2
|
||||
|
||||
BasePanel {
|
||||
width: 40
|
||||
|
||||
BaseSlider {
|
||||
objectName: "water_height"
|
||||
minimumValue: -1
|
||||
maximumValue: 1
|
||||
orientation: Qt.Vertical
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
}
|
||||
}
|
45
src/interface/modeler/quickapp/qml/WaterSection.qml
Normal file
45
src/interface/modeler/quickapp/qml/WaterSection.qml
Normal file
|
@ -0,0 +1,45 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
// Water control
|
||||
BaseSection {
|
||||
id: section
|
||||
|
||||
BaseToolbar {
|
||||
id: toolbar
|
||||
|
||||
ToolbarButton {
|
||||
id: tool_water_level
|
||||
selected: true
|
||||
picture: "images/icon_water_level.png"
|
||||
hovertext: qsTr("Change the water altitude")
|
||||
}
|
||||
}
|
||||
|
||||
BasePanel {
|
||||
id: panel_water_level
|
||||
width: 40
|
||||
anchors.left: toolbar.right
|
||||
enabled: false
|
||||
|
||||
BaseSlider {
|
||||
objectName: "water_height"
|
||||
minimumValue: -1
|
||||
maximumValue: 1
|
||||
orientation: Qt.Vertical
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "WaterHeight"
|
||||
when: tool_water_level.selected
|
||||
PropertyChanges {
|
||||
target: panel_water_level
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -9,14 +9,13 @@
|
|||
<file>images/tab_textures.png</file>
|
||||
<file>images/tab_water.png</file>
|
||||
<file>images/tab_display.png</file>
|
||||
<file>Toolbar.qml</file>
|
||||
<file>BaseToolbar.qml</file>
|
||||
<file>images/display_topdown.png</file>
|
||||
<file>images/help.png</file>
|
||||
<file>Tooltip.qml</file>
|
||||
<file>images/icon_water.png</file>
|
||||
<file>images/icon_water_level.png</file>
|
||||
<file>BasePanel.qml</file>
|
||||
<file>PanelWaterLevel.qml</file>
|
||||
<file>images/icon_atmosphere.png</file>
|
||||
<file>images/icon_atmosphere_daytime.png</file>
|
||||
<file>BaseSlider.qml</file>
|
||||
|
@ -40,5 +39,8 @@
|
|||
<file>images/toggle_water.png</file>
|
||||
<file>images/icon_render_quick.png</file>
|
||||
<file>images/icon_render_show.png</file>
|
||||
<file>WaterSection.qml</file>
|
||||
<file>BaseSection.qml</file>
|
||||
<file>AtmosphereSection.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -15,7 +15,7 @@ OpenGLView {
|
|||
anchors.right: primary_toolbar.right
|
||||
}
|
||||
|
||||
Toolbar {
|
||||
BaseToolbar {
|
||||
id: primary_toolbar
|
||||
horizontal: true
|
||||
color: "#90888888"
|
||||
|
@ -61,24 +61,14 @@ OpenGLView {
|
|||
}
|
||||
}
|
||||
|
||||
BaseSecondaryToolbar {
|
||||
id: water_toolbar
|
||||
|
||||
ToolbarButton {
|
||||
id: tool_water_level
|
||||
picture: "images/icon_water_level.png"
|
||||
hovertext: qsTr("Change the water altitude")
|
||||
}
|
||||
WaterSection {
|
||||
id: water_section
|
||||
enabled: false
|
||||
}
|
||||
|
||||
BaseSecondaryToolbar {
|
||||
id: atmosphere_toolbar
|
||||
|
||||
ToolbarButton {
|
||||
id: tool_atmosphere_daytime
|
||||
picture: "images/icon_atmosphere_daytime.png"
|
||||
hovertext: qsTr("Change the time of day")
|
||||
}
|
||||
AtmosphereSection {
|
||||
id: atmosphere_section
|
||||
enabled: false
|
||||
}
|
||||
|
||||
BaseSecondaryToolbar {
|
||||
|
@ -158,22 +148,13 @@ OpenGLView {
|
|||
anchors.fill: parent
|
||||
}
|
||||
|
||||
PanelWaterLevel {
|
||||
id: panel_water_level
|
||||
tool: tool_water_level
|
||||
}
|
||||
PanelAtmosphereDaytime {
|
||||
id: panel_atmosphere_daytime
|
||||
tool: tool_atmosphere_daytime
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "Water Mode"
|
||||
when: tool_water.selected
|
||||
|
||||
PropertyChanges {
|
||||
target: water_toolbar
|
||||
target: water_section
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
|
@ -182,7 +163,7 @@ OpenGLView {
|
|||
when: tool_atmosphere.selected
|
||||
|
||||
PropertyChanges {
|
||||
target: atmosphere_toolbar
|
||||
target: atmosphere_section
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -67,16 +67,4 @@ INCLUDEPATH += $$PWD/../../../render/opengl
|
|||
DEPENDPATH += $$PWD/../../../render/opengl
|
||||
|
||||
OTHER_FILES += \
|
||||
qml/main.qml \
|
||||
qml/ToolbarButton.qml \
|
||||
qml/OpenGLView.qml \
|
||||
qml/Toolbar.qml \
|
||||
qml/Tooltip.qml \
|
||||
qml/BasePanel.qml \
|
||||
qml/PanelWaterLevel.qml \
|
||||
qml/PanelAtmosphereDaytime.qml \
|
||||
qml/BaseSlider.qml \
|
||||
qml/BaseChoice.qml \
|
||||
qml/BaseChoiceItem.qml \
|
||||
qml/RenderDialog.qml \
|
||||
qml/CameraChoice.qml
|
||||
qml/*.qml
|
||||
|
|
Loading…
Reference in a new issue