+ improve GraphicsScene class

This commit is contained in:
wmayer
2016-03-26 19:02:15 +01:00
parent bd46939070
commit b86e14afff
3 changed files with 552 additions and 57 deletions

View File

@@ -29,14 +29,41 @@
#include <Gui/MDIView.h>
#include <Base/Parameter.h>
class QUrl;
class QGraphicsView;
class QDialog;
class QLabel;
class SoCamera;
class SoSeparator;
class SoRenderManager;
namespace SIM { namespace Coin3D { namespace Quarter {
class InputDevice;
}}}
namespace Gui {
class SceneEventFilter : public QObject
{
Q_OBJECT
public:
SceneEventFilter(QObject * parent);
~SceneEventFilter();
void registerInputDevice(SIM::Coin3D::Quarter::InputDevice * device);
void unregisterInputDevice(SIM::Coin3D::Quarter::InputDevice * device);
const QPoint & globalMousePosition(void) const;
protected:
bool eventFilter(QObject * obj, QEvent * event);
private:
class Private;
Private* pimpl;
};
class /*GuiExport*/ GraphicsScene : public QGraphicsScene
{
Q_OBJECT
@@ -49,7 +76,24 @@ public:
void setBackgroundColor(const QColor&);
void viewAll();
SoSeparator* getSceneGraph() const;
void setSceneGraph(SoNode * node);
SoNode* getSceneGraph() const;
SceneEventFilter *
getEventFilter(void) const;
void addStateMachine(SoScXMLStateMachine * statemachine);
void removeStateMachine(SoScXMLStateMachine * statemachine);
void setNavigationModeFile(const QUrl&);
bool processSoEvent(const SoEvent * event);
SoRenderManager *
getSoRenderManager(void) const;
SoEventManager *
getSoEventManager(void) const;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
@@ -57,9 +101,14 @@ protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);
private Q_SLOTS:
void onSceneRectChanged(const QRectF & rect);
private:
QDialog *createDialog(const QString &windowTitle) const;
SoCamera* searchForCamera(SoNode * root);
private:
QColor m_backgroundColor;
QTime m_time;
@@ -71,11 +120,23 @@ private:
QLabel *m_labels[4];
QWidget *m_modelButton;
SoSeparator* rootNode;
mutable SoSeparator* sceneNode;
SoCamera* sceneCamera;
mutable SoNode* sceneNode;
SoNode* headlight;
QGraphicsRectItem *m_lightItem;
SoRenderManager* sorendermanager;
SoEventManager* soeventmanager;
SceneEventFilter* eventfilter;
};
class GraphicsView : public QGraphicsView
{
public:
GraphicsView();
~GraphicsView();
protected:
void resizeEvent(QResizeEvent *event);
};
class /*GuiExport*/ GraphicsView3D : public Gui::MDIView