Fixed: #1301 Fixed incorrect work landscape plugin with other plugins which use opengl (object_viewer plugin).

This commit is contained in:
dnk-88 2011-07-02 13:00:28 +03:00
parent d1988c7414
commit aedfcced67
2 changed files with 19 additions and 4 deletions

View file

@ -34,14 +34,17 @@
// Qt includes // Qt includes
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
#include <QtOpenGL/QGLWidget>
namespace LandscapeEditor namespace LandscapeEditor
{ {
QString _lastDir; QString _lastDir;
LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent) LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent),
m_landscapeScene(0),
m_zoneBuilder(0),
m_undoStack(0),
m_oglWidget(0)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
@ -55,8 +58,9 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
m_landscapeScene->setZoneBuilder(m_zoneBuilder); m_landscapeScene->setZoneBuilder(m_zoneBuilder);
m_ui.graphicsView->setScene(m_landscapeScene); m_ui.graphicsView->setScene(m_landscapeScene);
//m_ui.graphicsView->setViewport(new QGLWidget(QGLFormat(QGL::DoubleBuffer))); //m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer));
m_ui.graphicsView->setViewport(new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers))); m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers));
m_ui.graphicsView->setViewport(m_oglWidget);
createMenus(); createMenus();
createToolBars(); createToolBars();
@ -150,6 +154,12 @@ void LandscapeEditorWindow::openSnapshotDialog()
delete dialog; delete dialog;
} }
void LandscapeEditorWindow::showEvent(QShowEvent *showEvent)
{
QMainWindow::showEvent(showEvent);
m_oglWidget->makeCurrent();
}
void LandscapeEditorWindow::createMenus() void LandscapeEditorWindow::createMenus()
{ {
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager(); Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();

View file

@ -23,6 +23,7 @@
// Qt includes // Qt includes
#include <QtGui/QUndoStack> #include <QtGui/QUndoStack>
#include <QtOpenGL/QGLWidget>
namespace LandscapeEditor namespace LandscapeEditor
{ {
@ -49,6 +50,9 @@ private Q_SLOTS:
void openProjectSettings(); void openProjectSettings();
void openSnapshotDialog(); void openSnapshotDialog();
protected:
virtual void showEvent(QShowEvent *showEvent);
private: private:
void createMenus(); void createMenus();
void createToolBars(); void createToolBars();
@ -58,6 +62,7 @@ private:
LandscapeScene *m_landscapeScene; LandscapeScene *m_landscapeScene;
ZoneBuilder *m_zoneBuilder; ZoneBuilder *m_zoneBuilder;
QUndoStack *m_undoStack; QUndoStack *m_undoStack;
QGLWidget *m_oglWidget;
Ui::LandscapeEditorWindow m_ui; Ui::LandscapeEditorWindow m_ui;
}; /* class LandscapeEditorWindow */ }; /* class LandscapeEditorWindow */