mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
fixed closeEvent by subclassing QDockWidget instead of QgsGLWidgetAdapter
This commit is contained in:
parent
34a7461ea0
commit
8f40cd8ca6
@ -113,7 +113,7 @@ void GlobePlugin::initGui()
|
||||
SLOT( projectReady() ) );
|
||||
connect( mQGisIface->mainWindow(), SIGNAL( newProjectCreated() ), this,
|
||||
SLOT( blankProjectReady() ) );
|
||||
connect( &viewer, SIGNAL( globeClosed() ), this,
|
||||
connect( &mQDockWidget, SIGNAL( globeClosed() ), this,
|
||||
SLOT( setGlobeNotRunning() ) );
|
||||
|
||||
}
|
||||
@ -741,9 +741,7 @@ void GlobePlugin::copyFolder( QString sourceFolder, QString destFolder )
|
||||
|
||||
void GlobePlugin::setGlobeNotRunning()
|
||||
{
|
||||
QMessageBox m;
|
||||
m.setText("globe not running");
|
||||
m.exec();
|
||||
QgsDebugMsg( "Globe Closed" );
|
||||
mIsGlobeRunning = false;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "globe_plugin_dialog.h"
|
||||
#include "Controls"
|
||||
#include <QObject>
|
||||
#include <QDockWidget>
|
||||
#include <osgEarth/MapNode>
|
||||
#include <osgEarth/MapLayer>
|
||||
#include <osgEarthUtil/EarthManipulator>
|
||||
@ -98,7 +97,7 @@ class GlobePlugin : public QObject, public QgisPlugin
|
||||
//! OSG Viewer
|
||||
QgsOsgViewer viewer;
|
||||
//! Dock widget for viewer
|
||||
QDockWidget mQDockWidget;
|
||||
QDockWidgetGlobe mQDockWidget;
|
||||
//! Settings Dialog
|
||||
QgsGlobePluginDialog mSettingsDialog;
|
||||
//! OSG root node
|
||||
|
@ -23,6 +23,22 @@
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
|
||||
QDockWidgetGlobe::QDockWidgetGlobe(const QString &title, QWidget *parent, Qt::WindowFlags flags):
|
||||
QDockWidget(title, parent, flags)
|
||||
{
|
||||
};
|
||||
|
||||
QDockWidgetGlobe::QDockWidgetGlobe(QWidget *parent, Qt::WindowFlags flags):
|
||||
QDockWidget(parent, flags)
|
||||
{
|
||||
};
|
||||
|
||||
//reimplement the close event to emit a signal
|
||||
void QDockWidgetGlobe::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
emit globeClosed();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
QgsGLWidgetAdapter::QgsGLWidgetAdapter( QWidget * parent, const char * name, const QGLWidget * shareWidget, WindowFlags f):
|
||||
QGLWidget(parent, shareWidget, f)
|
||||
@ -85,13 +101,3 @@ void QgsGLWidgetAdapter::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
_gw->getEventQueue()->mouseScroll((event->delta()>0) ? osgGA::GUIEventAdapter::SCROLL_DOWN : osgGA::GUIEventAdapter::SCROLL_UP);
|
||||
}
|
||||
|
||||
//reimplement the close event to emit a signal
|
||||
void QgsGLWidgetAdapter::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QMessageBox m;
|
||||
m.setText("close event");
|
||||
m.exec();
|
||||
emit globeClosed();
|
||||
event->accept();
|
||||
}
|
@ -22,11 +22,30 @@
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QtGui/QDockWidget>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
using Qt::WindowFlags;
|
||||
|
||||
class QDockWidgetGlobe : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QDockWidgetGlobe(const QString& title, QWidget* parent = 0, WindowFlags flags = 0);
|
||||
QDockWidgetGlobe(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
|
||||
virtual ~QDockWidgetGlobe() {}
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
||||
signals:
|
||||
void globeClosed();
|
||||
};
|
||||
|
||||
|
||||
class QgsGLWidgetAdapter : public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -49,12 +68,9 @@ class QgsGLWidgetAdapter : public QGLWidget
|
||||
virtual void mouseReleaseEvent( QMouseEvent* event );
|
||||
virtual void mouseMoveEvent( QMouseEvent* event );
|
||||
virtual void wheelEvent( QWheelEvent * event );
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
||||
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> _gw;
|
||||
|
||||
signals:
|
||||
void globeClosed();
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user