18 #ifndef _OF_QTOSGADAPTERS_ 19 #define _OF_QTOSGADAPTERS_ 24 #include <osg/observer_ptr> 30 #include <QGraphicsScene> 31 #include <QGraphicsView> 36 QT_FORWARD_DECLARE_CLASS(QCoreApplication)
37 QT_FORWARD_DECLARE_CLASS(QPainter)
38 QT_FORWARD_DECLARE_CLASS(QtEvents)
43 extern QCoreApplication* getOrCreateQApplication();
53 bool sendPointerEvent(
int x,
int y,
int buttonMask);
54 bool sendKeyEvent(
int key,
bool keyDown);
56 void setFrameLastRendered(
const osg::FrameStamp* frameStamp);
57 void clearWriteBuffer();
59 void assignImage(
unsigned int i);
61 void resize(
int width,
int height);
62 void setBackgroundColor(QColor color) { _backgroundColor = color; }
63 QColor getBackgroundColor()
const {
return _backgroundColor; }
68 const std::vector<QWidget*> &getIgnoredWidgets()
const {
return _ignoredWidgets; }
70 QGraphicsView* getQGraphicsView() {
return _graphicsView.data(); }
71 QGraphicsScene* getQGraphicsScene() {
return _graphicsScene.data(); }
74 bool handlePointerEvent(
int x,
int y,
int buttonMask);
75 bool handleKeyEvent(
int key,
bool keyDown);
76 QWidget* getWidgetAt(
const QPoint& pos);
78 osg::observer_ptr<osg::Image> _image;
79 std::vector<QWidget*> _ignoredWidgets;
81 int _previousButtonMask;
84 int _previousQtMouseX;
85 int _previousQtMouseY;
86 bool _previousSentEvent;
91 typedef std::map<int, Qt::Key> KeyMap;
93 Qt::KeyboardModifiers _qtKeyModifiers;
95 QColor _backgroundColor;
96 QPointer<QGraphicsView> _graphicsView;
97 QPointer<QGraphicsScene> _graphicsScene;
98 QPointer<QWidget> _widget;
100 OpenThreads::Mutex _qimagesMutex;
101 OpenThreads::Mutex _qresizeMutex;
102 unsigned int _previousFrameNumber;
103 bool _newImageAvailable;
104 unsigned int _currentRead;
105 unsigned int _currentWrite;
106 unsigned int _previousWrite;
109 virtual void customEvent(QEvent * event);
112 void repaintRequestedSlot(
const QList<QRectF> ®ions);
113 void repaintRequestedSlot(
const QRectF ®ion);
121 QWidget* getQWidget() {
return _widget.data(); }
124 virtual bool requiresUpdateCall()
const {
return true; }
125 virtual void update(osg::NodeVisitor* ) { render(); }
126 void clearWriteBuffer();
131 virtual void scaleImage(
int s,
int t,
int r, GLenum newDataType);
133 virtual bool sendFocusHint(
bool focus);
134 virtual bool sendPointerEvent(
int x,
int y,
int buttonMask);
135 virtual bool sendKeyEvent(
int key,
bool keyDown);
137 virtual void setFrameLastRendered(
const osg::FrameStamp* frameStamp);
140 QPointer<QGraphicsViewAdapter> _adapter;
141 QPointer<QWidget> _widget;
void setIgnoredWidgets(const std::vector< QWidget *> &w)
Definition: QtOSGAdapters.hpp:67
Definition: CoordinateAxes.hpp:29
Definition: QtOSGAdapters.hpp:45