Fixed UI not reverting to previous state when exiting render dialog

This commit is contained in:
Michaël Lemaire 2015-08-26 00:28:12 +02:00
parent c450774995
commit 623a3606eb
3 changed files with 30 additions and 15 deletions

View file

@ -128,7 +128,7 @@ void MainModelerWindow::keyReleaseEvent(QKeyEvent *event)
{ {
render_process->stopRender(); render_process->stopRender();
setState("Init"); setState(rootObject()->property("previous_state").toString());
} }
} }
else else

View file

@ -10,13 +10,12 @@ BaseRectangle {
preview_image.source = "image://renderpreviewprovider/live"; preview_image.source = "image://renderpreviewprovider/live";
} }
onOpacityChanged: { onVisibleChanged: {
if (visible)
{
refresh(); refresh();
render_progress.value = 0; render_progress.value = 0;
} }
onVisibleChanged: {
refresh();
render_progress.value = 0;
} }
Image { Image {

View file

@ -4,6 +4,7 @@ import Paysages 1.0
OpenGLView { OpenGLView {
id: main_ui id: main_ui
state: "Init" state: "Init"
property string previous_state
width: 1000 width: 1000
height: 700 height: 700
@ -148,6 +149,13 @@ OpenGLView {
anchors.fill: parent anchors.fill: parent
} }
onStateChanged: {
if (state != "Render Dialog")
{
previous_state = state;
}
}
states: [ states: [
State { State {
name: "Water Mode" name: "Water Mode"
@ -157,6 +165,10 @@ OpenGLView {
target: water_section target: water_section
enabled: true enabled: true
} }
PropertyChanges {
target: tool_water
selected: true
}
}, },
State { State {
name: "Atmosphere Mode" name: "Atmosphere Mode"
@ -166,6 +178,10 @@ OpenGLView {
target: atmosphere_section target: atmosphere_section
enabled: true enabled: true
} }
PropertyChanges {
target: tool_atmosphere
selected: true
}
}, },
State { State {
name: "Render Mode" name: "Render Mode"
@ -175,6 +191,10 @@ OpenGLView {
target: render_toolbar target: render_toolbar
enabled: true enabled: true
} }
PropertyChanges {
target: tool_render
selected: true
}
}, },
State { State {
name: "File Mode" name: "File Mode"
@ -184,18 +204,14 @@ OpenGLView {
target: file_toolbar target: file_toolbar
enabled: true enabled: true
} }
PropertyChanges {
target: tool_file
selected: true
}
}, },
State { State {
name: "Render Dialog" name: "Render Dialog"
PropertyChanges {
target: primary_toolbar
enabled: false
}
PropertyChanges {
target: camera_choice
enabled: false
}
PropertyChanges { PropertyChanges {
target: render_dialog target: render_dialog
enabled: true enabled: true