diff --git a/src/interface/modeler/quickapp/OpenGLView.cpp b/src/interface/modeler/quickapp/OpenGLView.cpp index cc828e6..e1a90f8 100644 --- a/src/interface/modeler/quickapp/OpenGLView.cpp +++ b/src/interface/modeler/quickapp/OpenGLView.cpp @@ -18,6 +18,8 @@ OpenGLView::OpenGLView(QQuickItem *parent) : mouse_button = Qt::NoButton; connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(handleWindowChanged(QQuickWindow*))); + connect(this, SIGNAL(widthChanged()), this, SLOT(handleResize())); + connect(this, SIGNAL(heightChanged()), this, SLOT(handleResize())); startTimer(50); } @@ -45,9 +47,15 @@ void OpenGLView::paint() { renderer->initialize(); initialized = true; + resized = true; + } + + if (resized) + { + renderer->resize(width(), height()); + resized = false; } - renderer->resize(width(), height()); renderer->prepareOpenGLState(); renderer->paint(); @@ -57,6 +65,11 @@ void OpenGLView::paint() } } +void OpenGLView::handleResize() +{ + resized = true; +} + void OpenGLView::wheelEvent(QWheelEvent *event) { if (not acceptInputs()) diff --git a/src/interface/modeler/quickapp/OpenGLView.h b/src/interface/modeler/quickapp/OpenGLView.h index 5a6fc99..58f2075 100644 --- a/src/interface/modeler/quickapp/OpenGLView.h +++ b/src/interface/modeler/quickapp/OpenGLView.h @@ -17,6 +17,7 @@ public: public slots: void handleWindowChanged(QQuickWindow *win); void paint(); + void handleResize(); protected: virtual void wheelEvent(QWheelEvent *event) override; @@ -31,6 +32,7 @@ private: private: bool initialized; + bool resized; MainModelerWindow *window; OpenGLRenderer *renderer;