From b1d6db2668b6d1cf05f5196913cef84f1151545a Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sat, 2 Jul 2011 13:00:28 +0300 Subject: [PATCH] Fixed: #1301 Fixed incorrect work landscape plugin with other plugins which use opengl (object_viewer plugin). --HG-- branch : gsoc2011-worldeditorqt --- .../landscape_editor_window.cpp | 18 ++++++++++++++---- .../landscape_editor/landscape_editor_window.h | 5 +++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp index facf90264..abfdcbd35 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp @@ -34,14 +34,17 @@ // Qt includes #include #include -#include namespace LandscapeEditor { QString _lastDir; LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent) - : QMainWindow(parent) + : QMainWindow(parent), + m_landscapeScene(0), + m_zoneBuilder(0), + m_undoStack(0), + m_oglWidget(0) { m_ui.setupUi(this); @@ -55,8 +58,9 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent) m_landscapeScene->setZoneBuilder(m_zoneBuilder); m_ui.graphicsView->setScene(m_landscapeScene); - //m_ui.graphicsView->setViewport(new QGLWidget(QGLFormat(QGL::DoubleBuffer))); - m_ui.graphicsView->setViewport(new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers))); + //m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer)); + m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers)); + m_ui.graphicsView->setViewport(m_oglWidget); createMenus(); createToolBars(); @@ -150,6 +154,12 @@ void LandscapeEditorWindow::openSnapshotDialog() delete dialog; } +void LandscapeEditorWindow::showEvent(QShowEvent *showEvent) +{ + QMainWindow::showEvent(showEvent); + m_oglWidget->makeCurrent(); +} + void LandscapeEditorWindow::createMenus() { Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.h index ccfcf2778..ff9cfd273 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.h @@ -23,6 +23,7 @@ // Qt includes #include +#include namespace LandscapeEditor { @@ -49,6 +50,9 @@ private Q_SLOTS: void openProjectSettings(); void openSnapshotDialog(); +protected: + virtual void showEvent(QShowEvent *showEvent); + private: void createMenus(); void createToolBars(); @@ -58,6 +62,7 @@ private: LandscapeScene *m_landscapeScene; ZoneBuilder *m_zoneBuilder; QUndoStack *m_undoStack; + QGLWidget *m_oglWidget; Ui::LandscapeEditorWindow m_ui; }; /* class LandscapeEditorWindow */