diff --git a/src/interface/modeler/quickapp/MainModelerWindow.cpp b/src/interface/modeler/quickapp/MainModelerWindow.cpp
index d8494ca..c25208f 100644
--- a/src/interface/modeler/quickapp/MainModelerWindow.cpp
+++ b/src/interface/modeler/quickapp/MainModelerWindow.cpp
@@ -68,6 +68,11 @@ void MainModelerWindow::setQmlProperty(const QString &objectName, const QString
}
}
+QString MainModelerWindow::getState() const
+{
+ return rootObject()->property("state").toString();
+}
+
void MainModelerWindow::setState(const QString &stateName)
{
rootObject()->setProperty("state", stateName);
@@ -75,54 +80,60 @@ void MainModelerWindow::setState(const QString &stateName)
void MainModelerWindow::keyReleaseEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_F5)
+ if (getState() == "Render Dialog")
{
- // Start render in a thread
- if (event->modifiers() & Qt::ControlModifier)
+ if (event->key() == Qt::Key_Escape)
{
- render_process->startFinalRender();
- }
- else
- {
- render_process->startQuickRender();
- }
- }
- else if (event->key() == Qt::Key_F6)
- {
- render_process->showPreviousRender();
- }
- else if (event->key() == Qt::Key_Escape)
- {
- render_process->stopRender();
+ render_process->stopRender();
- setState("Init");
- }
- else if (event->key() == Qt::Key_Q)
- {
- if (event->modifiers() & Qt::ControlModifier)
- {
- QGuiApplication::instance()->exit();
+ setState("Init");
}
}
- else if (event->key() == Qt::Key_Z)
+ else
{
- if (event->modifiers() & Qt::ControlModifier)
+ if (event->key() == Qt::Key_F5)
{
- if (event->modifiers() & Qt::ShiftModifier)
+ // Start render in a thread
+ if (event->modifiers() & Qt::ControlModifier)
{
- scenery->getDiffManager()->redo();
+ render_process->startFinalRender();
}
else
+ {
+ render_process->startQuickRender();
+ }
+ }
+ else if (event->key() == Qt::Key_F6)
+ {
+ render_process->showPreviousRender();
+ }
+ else if (event->key() == Qt::Key_Q)
+ {
+ if (event->modifiers() & Qt::ControlModifier)
+ {
+ QGuiApplication::instance()->exit();
+ }
+ }
+ else if (event->key() == Qt::Key_Z)
+ {
+ if (event->modifiers() & Qt::ControlModifier)
+ {
+ if (event->modifiers() & Qt::ShiftModifier)
+ {
+ scenery->getDiffManager()->redo();
+ }
+ else
+ {
+ scenery->getDiffManager()->undo();
+ }
+ }
+ }
+ else if (event->key() == Qt::Key_Y)
+ {
+ if (event->modifiers() & Qt::ControlModifier)
{
scenery->getDiffManager()->undo();
}
}
}
- else if (event->key() == Qt::Key_Y)
- {
- if (event->modifiers() & Qt::ControlModifier)
- {
- scenery->getDiffManager()->undo();
- }
- }
}
diff --git a/src/interface/modeler/quickapp/MainModelerWindow.h b/src/interface/modeler/quickapp/MainModelerWindow.h
index 7ce00ac..0f235d3 100644
--- a/src/interface/modeler/quickapp/MainModelerWindow.h
+++ b/src/interface/modeler/quickapp/MainModelerWindow.h
@@ -17,6 +17,8 @@ public:
QObject *findQmlObject(const QString &objectName);
void setQmlProperty(const QString &objectName, const QString &propertyName, const QVariant &value);
+
+ QString getState() const;
void setState(const QString &stateName);
inline Scenery *getScenery() const {return scenery;}
diff --git a/src/interface/modeler/quickapp/OpenGLView.cpp b/src/interface/modeler/quickapp/OpenGLView.cpp
index af64bf4..4233d84 100644
--- a/src/interface/modeler/quickapp/OpenGLView.cpp
+++ b/src/interface/modeler/quickapp/OpenGLView.cpp
@@ -59,23 +59,43 @@ void OpenGLView::paint()
void OpenGLView::wheelEvent(QWheelEvent *event)
{
+ if (not acceptInputs())
+ {
+ return;
+ }
+
double factor = getSpeedFactor(event);
window->getCamera()->processZoom(0.1 * factor * (double)event->angleDelta().y());
}
void OpenGLView::mousePressEvent(QMouseEvent *event)
{
+ if (not acceptInputs())
+ {
+ return;
+ }
+
mouse_button = event->button();
mouse_pos = event->windowPos();
}
void OpenGLView::mouseReleaseEvent(QMouseEvent *)
{
+ if (not acceptInputs())
+ {
+ return;
+ }
+
mouse_button = Qt::NoButton;
}
void OpenGLView::mouseMoveEvent(QMouseEvent *event)
{
+ if (not acceptInputs())
+ {
+ return;
+ }
+
double factor = getSpeedFactor(event);
QPointF diff = event->windowPos() - mouse_pos;
if (mouse_button == Qt::LeftButton)
@@ -97,6 +117,11 @@ void OpenGLView::timerEvent(QTimerEvent *)
}
}
+bool OpenGLView::acceptInputs() const
+{
+ return window->getState() != "Render Dialog";
+}
+
double OpenGLView::getSpeedFactor(QInputEvent *event)
{
if (event->modifiers() & Qt::ControlModifier)
diff --git a/src/interface/modeler/quickapp/OpenGLView.h b/src/interface/modeler/quickapp/OpenGLView.h
index 7f8d1b0..5a6fc99 100644
--- a/src/interface/modeler/quickapp/OpenGLView.h
+++ b/src/interface/modeler/quickapp/OpenGLView.h
@@ -26,6 +26,7 @@ protected:
virtual void timerEvent(QTimerEvent *event) override;
private:
+ bool acceptInputs() const;
double getSpeedFactor(QInputEvent *event);
private:
diff --git a/src/interface/modeler/quickapp/qml/BasePanel.qml b/src/interface/modeler/quickapp/qml/BasePanel.qml
index 14ce20d..36652ae 100644
--- a/src/interface/modeler/quickapp/qml/BasePanel.qml
+++ b/src/interface/modeler/quickapp/qml/BasePanel.qml
@@ -1,24 +1,17 @@
import QtQuick 2.0
-Rectangle {
+BaseRectangle {
property ToolbarButton tool
id: panel
- opacity: 0
+ enabled: false
width: 200
height: parent.height - 100
color: "#a0909090"
- enabled: visible
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
- Behavior on opacity {
- PropertyAnimation {
- duration: 200
- }
- }
-
states: [
State {
name: "Active"
@@ -26,8 +19,7 @@ Rectangle {
PropertyChanges {
target: panel
- visible: true
- opacity: 1
+ enabled: true
}
}
diff --git a/src/interface/modeler/quickapp/qml/BaseRectangle.qml b/src/interface/modeler/quickapp/qml/BaseRectangle.qml
new file mode 100644
index 0000000..956ccbb
--- /dev/null
+++ b/src/interface/modeler/quickapp/qml/BaseRectangle.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ opacity: enabled ? 1 : 0
+ enabled: true
+
+ Behavior on opacity {
+ PropertyAnimation {
+ duration: 200
+ }
+ }
+}
+
diff --git a/src/interface/modeler/quickapp/qml/CameraChoice.qml b/src/interface/modeler/quickapp/qml/CameraChoice.qml
index 8df3ae4..b8bdb57 100644
--- a/src/interface/modeler/quickapp/qml/CameraChoice.qml
+++ b/src/interface/modeler/quickapp/qml/CameraChoice.qml
@@ -1,6 +1,6 @@
import QtQuick 2.0
-Rectangle {
+BaseRectangle {
id: camera_choice
width: 200
height: 50
diff --git a/src/interface/modeler/quickapp/qml/RenderDialog.qml b/src/interface/modeler/quickapp/qml/RenderDialog.qml
index e18de6e..e335090 100644
--- a/src/interface/modeler/quickapp/qml/RenderDialog.qml
+++ b/src/interface/modeler/quickapp/qml/RenderDialog.qml
@@ -1,7 +1,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
-Rectangle {
+BaseRectangle {
width: 400
height: 300
diff --git a/src/interface/modeler/quickapp/qml/Toolbar.qml b/src/interface/modeler/quickapp/qml/Toolbar.qml
index 9abfbc2..3e04d5e 100644
--- a/src/interface/modeler/quickapp/qml/Toolbar.qml
+++ b/src/interface/modeler/quickapp/qml/Toolbar.qml
@@ -1,12 +1,11 @@
import QtQuick 2.0
-Rectangle {
+BaseRectangle {
default property alias children : inner_space.children
width: 70
height: parent.height
color: "#50888888"
- enabled: opacity > 0
Column {
id: inner_space
@@ -14,12 +13,6 @@ Rectangle {
anchors.centerIn: parent
}
- Behavior on opacity {
- PropertyAnimation {
- duration: 200
- }
- }
-
onEnabledChanged: {
if (!enabled)
{
diff --git a/src/interface/modeler/quickapp/qml/Tooltip.qml b/src/interface/modeler/quickapp/qml/Tooltip.qml
index 0ec4c3c..05e1631 100644
--- a/src/interface/modeler/quickapp/qml/Tooltip.qml
+++ b/src/interface/modeler/quickapp/qml/Tooltip.qml
@@ -1,6 +1,6 @@
import QtQuick 2.0
-Rectangle {
+BaseRectangle {
property string helptext
property string hovertext
width: content.width
diff --git a/src/interface/modeler/quickapp/qml/app.qrc b/src/interface/modeler/quickapp/qml/app.qrc
index dc6d8a4..3b20493 100644
--- a/src/interface/modeler/quickapp/qml/app.qrc
+++ b/src/interface/modeler/quickapp/qml/app.qrc
@@ -27,5 +27,6 @@
BaseChoiceItem.qml
RenderDialog.qml
CameraChoice.qml
+ BaseRectangle.qml
diff --git a/src/interface/modeler/quickapp/qml/main.qml b/src/interface/modeler/quickapp/qml/main.qml
index 1bc2b03..951e286 100644
--- a/src/interface/modeler/quickapp/qml/main.qml
+++ b/src/interface/modeler/quickapp/qml/main.qml
@@ -56,7 +56,7 @@ OpenGLView {
Toolbar {
id: display_toolbar
- opacity: 0
+ enabled: false
anchors.left: primary_toolbar.right
ToolbarButton {
@@ -69,7 +69,7 @@ OpenGLView {
Toolbar {
id: water_toolbar
- opacity: 0
+ enabled: false
anchors.left: primary_toolbar.right
ToolbarButton {
@@ -81,7 +81,7 @@ OpenGLView {
Toolbar {
id: atmosphere_toolbar
- opacity: 0
+ enabled: false
anchors.left: primary_toolbar.right
ToolbarButton {
@@ -93,7 +93,7 @@ OpenGLView {
Toolbar {
id: render_toolbar
- opacity: 0
+ enabled: false
anchors.left: primary_toolbar.right
ToolbarButton {
@@ -112,7 +112,7 @@ OpenGLView {
RenderDialog {
id: render_dialog
- opacity: 0
+ enabled: false
anchors.fill: parent
}
@@ -132,7 +132,7 @@ OpenGLView {
PropertyChanges {
target: display_toolbar
- opacity: 1
+ enabled: true
}
},
State {
@@ -141,7 +141,7 @@ OpenGLView {
PropertyChanges {
target: water_toolbar
- opacity: 1
+ enabled: true
}
},
State {
@@ -150,7 +150,7 @@ OpenGLView {
PropertyChanges {
target: atmosphere_toolbar
- opacity: 1
+ enabled: true
}
},
State {
@@ -159,20 +159,23 @@ OpenGLView {
PropertyChanges {
target: render_toolbar
- opacity: 1
+ enabled: true
}
},
State {
name: "Render Dialog"
- when: tool_display.selected
PropertyChanges {
target: primary_toolbar
- opacity: 0
+ enabled: false
+ }
+ PropertyChanges {
+ target: camera_choice
+ enabled: false
}
PropertyChanges {
target: render_dialog
- opacity: 1
+ enabled: true
}
}
]