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 e6928f675d
commit cfd0c6990a
2 changed files with 19 additions and 4 deletions

View file

@ -34,14 +34,17 @@
// Qt includes
#include <QtCore/QSettings>
#include <QtGui/QFileDialog>
#include <QtOpenGL/QGLWidget>
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();

View file

@ -23,6 +23,7 @@
// Qt includes
#include <QtGui/QUndoStack>
#include <QtOpenGL/QGLWidget>
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 */