VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Signals | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes
makVrv::DtOsgAdapterQtWidget Class Reference

DtOsgAdapterQtWidget provides the mechanism for embedding an OSG context into a Qt widget. More...

Inheritance diagram for makVrv::DtOsgAdapterQtWidget:
Inheritance graph
[legend]

Signals

void devicePixelRatioChanged ()
 This signal is emitted when the high dpi scaling factor changes. More...
 

Public Member Functions

 DtOsgAdapterQtWidget (DtDe &de, osg::GraphicsContext::Traits *contextTraits, const QGLFormat &format, QWidget *parent=0, Qt::WindowFlags f=0)
 CTOR. More...
 
virtual ~DtOsgAdapterQtWidget ()
 DTOR. More...
 
osgViewer::GraphicsWindow * graphicsWindow ()
 Get the Graphics Window. More...
 
void setView (DtWindow *window)
 Set the osg window to forward off events such as resize. More...
 
DtWindowview () const
 
int widgetToNativeCoordinate (int widgetValue)
 Converts a point in possibly scaled widget coordinates to native coordinates to support Qt high dpi scaling. More...
 
int nativeToWidgetCoordinate (int nativeValue)
 Converts a point in native coordinates to possibly scaled widget coordinates to support Qt high dpi scaling. More...
 
virtual
osgGA::GUIEventAdapter::KeySymbol 
osgKeyFromQtKeyEvent (QKeyEvent *event)
 maps keys coming from Qt to osg::GuiEventAdapter::KeySymbols More...
 
virtual void processKeyPressEvent (QKeyEvent *keyEvent)
 process a key press event that came from Qt directly or from the key adapter More...
 
virtual void processKeyReleaseEvent (QKeyEvent *keyEvent)
 process a key release event that came from Qt directly or from the key adapter More...
 
virtual bool processTouchEvent (QTouchEvent *touchEvent)
 Process a touch event. More...
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual bool event (QEvent *event)
 
virtual QSize sizeHint () const
 
virtual void slot_onRightClickTerrainMenuRequest (double mouseX, double mouseY, DtChannel *channel)
 called by signal requesting a terrain-specific popup menu More...
 
virtual void slot_onRightClickSelectionMenuRequest (double mouseX, double mouseY, DtChannel *channel)
 called by signal requesting a selection-specific popup menu More...
 
virtual void slot_onWindowConfigurationModified (const DtWindowConfiguration &newWindowConfig)
 called by signal indicating a window configuration change More...
 

Static Public Member Functions

static QGLFormat createFormatFromTraits (const osg::GraphicsContext::Traits *contextTraits)
 Helper function to create a QFormat from an osg context traits. More...
 

Public Attributes

boost::signalslib::signal
< void(DtOsgAdapterQtWidget *)> 
signal_mouseEnter
 
boost::signalslib::signal
< void(DtOsgAdapterQtWidget *)> 
signal_mouseExit
 

Protected Slots

void emit_signal_pixelRatioChanged ()
 Simple wrapper to emit boost pixelRatioChanged signal from the Qt signal. More...
 

Protected Member Functions

void init ()
 
virtual bool channelInThisWidget (const DtChannel &channel)
 Find out if our window (myView) owns a channel. More...
 
virtual void resizeGL (int width, int height)
 
virtual void keyPressEvent (QKeyEvent *)
 
virtual void keyReleaseEvent (QKeyEvent *)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void enterEvent (QEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
int qtButtonToOsgButton (QMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void wheelEvent (QWheelEvent *)
 
virtual void closeEvent (QCloseEvent *)
 
virtual void slot_ctrlEnterPressed (const DtChannel &channel)
 
virtual void getTouchPointPositions (const QTouchEvent &touchEvent, osg::Vec2 &p0, osg::Vec2 &p1)
 Get the positions of the 2 touch points in a touch event; if the touch event has no touch points, p0 and p1 will be untouched. More...
 
virtual void startOsgTouch (const osg::Vec2 &p0, const osg::Vec2 &p1)
 This creates an osgGA GUI Adapter touch event with the Began phase and the points provided. More...
 
virtual void continueOsgTouch (const osg::Vec2 &p0, const osg::Vec2 &p1)
 This creates an osgGA GUI Adapter touch event with the Moved phase and the points provided. More...
 
virtual void endOsgTouch (const osg::Vec2 &p0)
 This creates an osgGA GUI Adapter touch event with the Ended phase and the points provided. More...
 

Protected Attributes

osg::ref_ptr
< osgViewer::GraphicsWindowEmbedded > 
myEmbeddedWindow
 
DtDemyDe
 
DtWindowmyWindow
 
DtOsgAdapterQtWidgetLogicmyLogic
 
bool myLeftPressed
 
bool myMiddlePressed
 
bool myRightPressed
 
bool myIsPinching
 
int myOldDevicePixelRatio
 

Detailed Description

DtOsgAdapterQtWidget provides the mechanism for embedding an OSG context into a Qt widget.

Constructor & Destructor Documentation

makVrv::DtOsgAdapterQtWidget::DtOsgAdapterQtWidget ( DtDe de,
osg::GraphicsContext::Traits *  contextTraits,
const QGLFormat &  format,
QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)

CTOR.

virtual makVrv::DtOsgAdapterQtWidget::~DtOsgAdapterQtWidget ( )
virtual

DTOR.

Member Function Documentation

osgViewer::GraphicsWindow* makVrv::DtOsgAdapterQtWidget::graphicsWindow ( )

Get the Graphics Window.

void makVrv::DtOsgAdapterQtWidget::setView ( DtWindow window)

Set the osg window to forward off events such as resize.

DtWindow* makVrv::DtOsgAdapterQtWidget::view ( ) const
int makVrv::DtOsgAdapterQtWidget::widgetToNativeCoordinate ( int  widgetValue)

Converts a point in possibly scaled widget coordinates to native coordinates to support Qt high dpi scaling.

Returns
widgetValue multiplied by devicePixelRatio. On unscaled content devicePixelRatio is 1.
int makVrv::DtOsgAdapterQtWidget::nativeToWidgetCoordinate ( int  nativeValue)

Converts a point in native coordinates to possibly scaled widget coordinates to support Qt high dpi scaling.

Returns
widgetValue multiplied by devicePixelRatio. On unscaled content devicePixelRatio is 1.
virtual osgGA::GUIEventAdapter::KeySymbol makVrv::DtOsgAdapterQtWidget::osgKeyFromQtKeyEvent ( QKeyEvent *  event)
virtual

maps keys coming from Qt to osg::GuiEventAdapter::KeySymbols

virtual void makVrv::DtOsgAdapterQtWidget::processKeyPressEvent ( QKeyEvent *  keyEvent)
virtual

process a key press event that came from Qt directly or from the key adapter

virtual void makVrv::DtOsgAdapterQtWidget::processKeyReleaseEvent ( QKeyEvent *  keyEvent)
virtual

process a key release event that came from Qt directly or from the key adapter

virtual bool makVrv::DtOsgAdapterQtWidget::processTouchEvent ( QTouchEvent *  touchEvent)
virtual

Process a touch event.

Touch events with two touchpoints are treated as pinches; others are ignored (exception - touch end events always have one touchpoint, even if its the end of a multitouch event; hence it is processed here IF we are current within an identified pinch gesture)

virtual void makVrv::DtOsgAdapterQtWidget::mouseMoveEvent ( QMouseEvent *  event)
virtual
virtual void makVrv::DtOsgAdapterQtWidget::focusInEvent ( QFocusEvent *  event)
virtual
virtual void makVrv::DtOsgAdapterQtWidget::focusOutEvent ( QFocusEvent *  event)
virtual
virtual bool makVrv::DtOsgAdapterQtWidget::event ( QEvent event)
virtual
static QGLFormat makVrv::DtOsgAdapterQtWidget::createFormatFromTraits ( const osg::GraphicsContext::Traits *  contextTraits)
static

Helper function to create a QFormat from an osg context traits.

virtual QSize makVrv::DtOsgAdapterQtWidget::sizeHint ( ) const
virtual
virtual void makVrv::DtOsgAdapterQtWidget::slot_onRightClickTerrainMenuRequest ( double  mouseX,
double  mouseY,
DtChannel channel 
)
virtual

called by signal requesting a terrain-specific popup menu

virtual void makVrv::DtOsgAdapterQtWidget::slot_onRightClickSelectionMenuRequest ( double  mouseX,
double  mouseY,
DtChannel channel 
)
virtual

called by signal requesting a selection-specific popup menu

virtual void makVrv::DtOsgAdapterQtWidget::slot_onWindowConfigurationModified ( const DtWindowConfiguration newWindowConfig)
virtual

called by signal indicating a window configuration change

void makVrv::DtOsgAdapterQtWidget::devicePixelRatioChanged ( )
signal

This signal is emitted when the high dpi scaling factor changes.

void makVrv::DtOsgAdapterQtWidget::init ( )
protected
virtual bool makVrv::DtOsgAdapterQtWidget::channelInThisWidget ( const DtChannel channel)
protectedvirtual

Find out if our window (myView) owns a channel.

Used when processing ctrlEnter signals

virtual void makVrv::DtOsgAdapterQtWidget::resizeGL ( int  width,
int  height 
)
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::keyPressEvent ( QKeyEvent *  )
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::keyReleaseEvent ( QKeyEvent *  )
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::mousePressEvent ( QMouseEvent *  event)
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::enterEvent ( QEvent event)
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::leaveEvent ( QEvent event)
protectedvirtual
int makVrv::DtOsgAdapterQtWidget::qtButtonToOsgButton ( QMouseEvent *  event)
protected
virtual void makVrv::DtOsgAdapterQtWidget::mouseDoubleClickEvent ( QMouseEvent *  event)
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::wheelEvent ( QWheelEvent *  )
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::closeEvent ( QCloseEvent *  )
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::slot_ctrlEnterPressed ( const DtChannel channel)
protectedvirtual
virtual void makVrv::DtOsgAdapterQtWidget::getTouchPointPositions ( const QTouchEvent &  touchEvent,
osg::Vec2 &  p0,
osg::Vec2 &  p1 
)
protectedvirtual

Get the positions of the 2 touch points in a touch event; if the touch event has no touch points, p0 and p1 will be untouched.

If the touch event has only one touch point, p0 will be set and p1 will be untouched.

virtual void makVrv::DtOsgAdapterQtWidget::startOsgTouch ( const osg::Vec2 &  p0,
const osg::Vec2 &  p1 
)
protectedvirtual

This creates an osgGA GUI Adapter touch event with the Began phase and the points provided.

virtual void makVrv::DtOsgAdapterQtWidget::continueOsgTouch ( const osg::Vec2 &  p0,
const osg::Vec2 &  p1 
)
protectedvirtual

This creates an osgGA GUI Adapter touch event with the Moved phase and the points provided.

virtual void makVrv::DtOsgAdapterQtWidget::endOsgTouch ( const osg::Vec2 &  p0)
protectedvirtual

This creates an osgGA GUI Adapter touch event with the Ended phase and the points provided.

void makVrv::DtOsgAdapterQtWidget::emit_signal_pixelRatioChanged ( )
protectedslot

Simple wrapper to emit boost pixelRatioChanged signal from the Qt signal.

Member Data Documentation

boost::signalslib::signal<void (DtOsgAdapterQtWidget*)> makVrv::DtOsgAdapterQtWidget::signal_mouseEnter
boost::signalslib::signal<void (DtOsgAdapterQtWidget*)> makVrv::DtOsgAdapterQtWidget::signal_mouseExit
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> makVrv::DtOsgAdapterQtWidget::myEmbeddedWindow
protected
DtDe& makVrv::DtOsgAdapterQtWidget::myDe
protected
DtWindow* makVrv::DtOsgAdapterQtWidget::myWindow
protected
DtOsgAdapterQtWidgetLogic* makVrv::DtOsgAdapterQtWidget::myLogic
protected
bool makVrv::DtOsgAdapterQtWidget::myLeftPressed
protected
bool makVrv::DtOsgAdapterQtWidget::myMiddlePressed
protected
bool makVrv::DtOsgAdapterQtWidget::myRightPressed
protected
bool makVrv::DtOsgAdapterQtWidget::myIsPinching
protected
int makVrv::DtOsgAdapterQtWidget::myOldDevicePixelRatio
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)