Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SIM::Coin3D::Quarter::QuarterWidget Class Reference

The QuarterWidget class is the main class in Quarter. It provides a widget for Coin rendering. It provides scene graph management and event handling. More...

#include <Quarter/QuarterWidget.h>

Inheritance diagram for SIM::Coin3D::Quarter::QuarterWidget:
QGLWidget

Public Types

enum  TransparencyType {
  SCREEN_DOOR = SoGLRenderAction::SCREEN_DOOR, ADD = SoGLRenderAction::ADD, DELAYED_ADD = SoGLRenderAction::DELAYED_ADD, SORTED_OBJECT_ADD = SoGLRenderAction::SORTED_OBJECT_ADD,
  BLEND = SoGLRenderAction::BLEND, DELAYED_BLEND = SoGLRenderAction::DELAYED_BLEND, SORTED_OBJECT_BLEND = SoGLRenderAction::SORTED_OBJECT_BLEND, SORTED_OBJECT_SORTED_TRIANGLE_ADD = SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_ADD,
  SORTED_OBJECT_SORTED_TRIANGLE_BLEND = SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_BLEND, NONE = SoGLRenderAction::NONE, SORTED_LAYERS_BLEND = SoGLRenderAction::SORTED_LAYERS_BLEND
}
 
enum  RenderMode {
  AS_IS = SoRenderManager::AS_IS, WIREFRAME = SoRenderManager::WIREFRAME, WIREFRAME_OVERLAY = SoRenderManager::WIREFRAME_OVERLAY, POINTS = SoRenderManager::POINTS,
  HIDDEN_LINE = SoRenderManager::HIDDEN_LINE, BOUNDING_BOX = SoRenderManager::BOUNDING_BOX
}
 
enum  StereoMode {
  MONO = SoRenderManager::MONO, ANAGLYPH = SoRenderManager::ANAGLYPH, QUAD_BUFFER = SoRenderManager::QUAD_BUFFER, INTERLEAVED_ROWS = SoRenderManager::INTERLEAVED_ROWS,
  INTERLEAVED_COLUMNS = SoRenderManager::INTERLEAVED_COLUMNS
}
 

Public Slots

virtual void viewAll (void)
 
virtual void seek (void)
 
void redraw (void)
 
void setRenderMode (RenderMode mode)
 
void setStereoMode (StereoMode mode)
 
void setTransparencyType (TransparencyType type)
 

Signals

void devicePixelRatioChanged (qreal dev_pixel_ratio)
 

Public Member Functions

 QuarterWidget (QWidget *parent=0, const QGLWidget *sharewidget=0, Qt::WindowFlags f=0)
 
 QuarterWidget (QGLContext *context, QWidget *parent=0, const QGLWidget *sharewidget=0, Qt::WindowFlags f=0)
 
 QuarterWidget (const QGLFormat &format, QWidget *parent=0, const QGLWidget *shareWidget=0, Qt::WindowFlags f=0)
 
virtual ~QuarterWidget ()
 
TransparencyType transparencyType (void) const
 
RenderMode renderMode (void) const
 
StereoMode stereoMode (void) const
 
void setBackgroundColor (const QColor &color)
 
QColor backgroundColor (void) const
 
qreal devicePixelRatio (void) const
 
void resetNavigationModeFile (void)
 
void setNavigationModeFile (const QUrl &url=QUrl(DEFAULT_NAVIGATIONFILE))
 
const QUrl & navigationModeFile (void) const
 
void setContextMenuEnabled (bool yes)
 
bool contextMenuEnabled (void) const
 
QMenu * getContextMenu (void) const
 
bool headlightEnabled (void) const
 
void setHeadlightEnabled (bool onoff)
 
SoDirectionalLightgetHeadlight (void)
 
bool clearZBuffer (void) const
 
void setClearZBuffer (bool onoff)
 
bool clearWindow (void) const
 
void setClearWindow (bool onoff)
 
bool interactionModeEnabled (void) const
 
void setInteractionModeEnabled (bool onoff)
 
bool interactionModeOn (void) const
 
void setInteractionModeOn (bool onoff)
 
void setStateCursor (const SbName &state, const QCursor &cursor)
 
QCursor stateCursor (const SbName &state)
 
uint32_t getCacheContextId (void) const
 
virtual void setSceneGraph (SoNode *root)
 
virtual SoNodegetSceneGraph (void) const
 
void setSoEventManager (SoEventManager *manager)
 
SoEventManagergetSoEventManager (void) const
 
void setSoRenderManager (SoRenderManager *manager)
 
SoRenderManagergetSoRenderManager (void) const
 
EventFiltergetEventFilter (void) const
 
void addStateMachine (SoScXMLStateMachine *statemachine)
 
void removeStateMachine (SoScXMLStateMachine *statemachine)
 
virtual bool processSoEvent (const SoEvent *event)
 
virtual QSize minimumSizeHint (void) const
 
QList< QAction * > transparencyTypeActions (void) const
 
QList< QAction * > stereoModeActions (void) const
 
QList< QAction * > renderModeActions (void) const
 

Protected Member Functions

virtual void resizeGL (int width, int height)
 
virtual void initializeGL (void)
 
virtual void paintGL (void)
 
virtual void actualRedraw (void)
 
virtual bool updateDevicePixelRatio (void)
 

Properties

QUrl navigationModeFile
 
QColor backgroundColor
 
bool contextMenuEnabled
 
bool headlightEnabled
 
bool clearZBuffer
 
bool clearWindow
 
bool interactionModeEnabled
 
bool interactionModeOn
 
TransparencyType transparencyType
 
RenderMode renderMode
 
StereoMode stereoMode
 
qreal devicePixelRatio
 

Detailed Description

The QuarterWidget class is the main class in Quarter. It provides a widget for Coin rendering. It provides scene graph management and event handling.

If you want to modify the GL format for an existing QuarterWidget, you can set up a new GL context for the widget, e.g.:

QGLContext * context = new QGLContext(QGLFormat(QGL::SampleBuffers), viewer);
if (context->create()) {
viewer->setContext(context);
}

Member Enumeration Documentation

◆ TransparencyType

Various settings for how to do rendering of transparent objects in the scene. Some of the settings will provide faster rendering, while others gives you better quality rendering.

See SoGLRenderAction::TransparencyType for a full description of the modes

◆ RenderMode

Sets how rendering of primitives is done.

See SoRenderManager::RenderMode for a full description of the modes

◆ StereoMode

Sets how stereo rendering is performed.

See SoRenderManager::StereoMode for a full description of the modes

Constructor & Destructor Documentation

◆ QuarterWidget() [1/3]

QuarterWidget::QuarterWidget ( QWidget *  parent = 0,
const QGLWidget sharewidget = 0,
Qt::WindowFlags  f = 0 
)
explicit

constructor

◆ QuarterWidget() [2/3]

QuarterWidget::QuarterWidget ( QGLContext *  context,
QWidget *  parent = 0,
const QGLWidget sharewidget = 0,
Qt::WindowFlags  f = 0 
)
explicit

constructor

◆ QuarterWidget() [3/3]

QuarterWidget::QuarterWidget ( const QGLFormat &  format,
QWidget *  parent = 0,
const QGLWidget sharewidget = 0,
Qt::WindowFlags  f = 0 
)
explicit

constructor

◆ ~QuarterWidget()

QuarterWidget::~QuarterWidget ( )
virtual

destructor

Member Function Documentation

◆ transparencyType()

QuarterWidget::TransparencyType QuarterWidget::transparencyType ( void  ) const
Return values
Thecurrent TransparencyType

◆ renderMode()

QuarterWidget::RenderMode QuarterWidget::renderMode ( void  ) const
Return values
Thecurrent RenderMode

◆ stereoMode()

QuarterWidget::StereoMode QuarterWidget::stereoMode ( void  ) const
Return values
Thecurrent StereoMode

◆ setBackgroundColor()

void QuarterWidget::setBackgroundColor ( const QColor &  color)

Set background color to a given QColor

Remember that QColors are given in integers between 0 and 255, as opposed to SbColor4f which is in [0, 1]. The default alpha value for a QColor is 255, but you'll probably want to set it to zero before using it as an OpenGL clear color.

◆ backgroundColor()

QColor QuarterWidget::backgroundColor ( void  ) const

Returns color used for clearing the rendering area before rendering the scene.

◆ devicePixelRatio()

qreal QuarterWidget::devicePixelRatio ( void  ) const

The ratio between logical and physical pixel sizes – obtained from the window that the widget is located within, and updated whenever any change occurs, emitting a devicePixelRatioChanged signal. Only available for version Qt 5.6 and above (will be 1.0 for all previous versions).

◆ resetNavigationModeFile()

void QuarterWidget::resetNavigationModeFile ( void  )

Removes any navigationModeFile set.

◆ setNavigationModeFile()

void QuarterWidget::setNavigationModeFile ( const QUrl &  url = QUrl(DEFAULT_NAVIGATIONFILE))

Sets a navigation mode file. Supports the schemes "coin" and "file"

Parameters
[in]urlURL to the resource

◆ navigationModeFile()

const QUrl & QuarterWidget::navigationModeFile ( void  ) const
Return values
Thecurrent navigation mode file

◆ setContextMenuEnabled()

void QuarterWidget::setContextMenuEnabled ( bool  yes)

Controls the display of the context menu

Parameters
[in]yesContext menu on?

◆ contextMenuEnabled()

bool QuarterWidget::contextMenuEnabled ( void  ) const
Return values
Iscontext menu enabled?

◆ getContextMenu()

QMenu * QuarterWidget::getContextMenu ( void  ) const

Returns the context menu used by the widget.

◆ headlightEnabled()

bool QuarterWidget::headlightEnabled ( void  ) const

Returns true if the headlight is on, false if it is off.

◆ setHeadlightEnabled()

void QuarterWidget::setHeadlightEnabled ( bool  onoff)

Enable/disable the headlight. This will toggle the SoDirectionalLight::on field (returned from getHeadlight()).

◆ getHeadlight()

SoDirectionalLight * QuarterWidget::getHeadlight ( void  )

Returns the light used for the headlight.

◆ clearZBuffer()

bool QuarterWidget::clearZBuffer ( void  ) const

Returns true if the z-buffer is cleared before rendering.

◆ setClearZBuffer()

void QuarterWidget::setClearZBuffer ( bool  onoff)

Specify if you want the z-buffer to be cleared before redraw. This is on by default.

◆ clearWindow()

bool QuarterWidget::clearWindow ( void  ) const

Returns true if the rendering buffer is cleared before rendering.

◆ setClearWindow()

void QuarterWidget::setClearWindow ( bool  onoff)

Specify if you want the rendering buffer to be cleared before rendering. This is on by default.

◆ interactionModeEnabled()

bool QuarterWidget::interactionModeEnabled ( void  ) const

Returns true if interaction mode is enabled, false otherwise.

◆ setInteractionModeEnabled()

void QuarterWidget::setInteractionModeEnabled ( bool  onoff)

Enable/disable interaction mode.

Specifies whether you may use the Alt-key to enter interaction mode.

◆ interactionModeOn()

bool QuarterWidget::interactionModeOn ( void  ) const

Returns true if interaction mode is on.

◆ setInteractionModeOn()

void QuarterWidget::setInteractionModeOn ( bool  onoff)

Turn interaction mode on or off.

◆ setStateCursor()

void QuarterWidget::setStateCursor ( const SbName state,
const QCursor &  cursor 
)

You can set the cursor you want to use for a given navigation state. See the Coin documentation on navigation for information about available states.

◆ stateCursor()

QCursor QuarterWidget::stateCursor ( const SbName state)

Maps a state to a cursor

Parameters
[in]stateNamed state in the state machine
Return values
Cursorcorresponding to the given state

◆ getCacheContextId()

uint32_t QuarterWidget::getCacheContextId ( void  ) const

Returns the Coin cache context id for this widget.

◆ setSceneGraph()

void QuarterWidget::setSceneGraph ( SoNode node)
virtual

Sets the Inventor scene graph to be rendered.

◆ getSceneGraph()

SoNode * QuarterWidget::getSceneGraph ( void  ) const
virtual

Returns pointer to root of scene graph.

◆ setSoEventManager()

void QuarterWidget::setSoEventManager ( SoEventManager manager)

Set the Coin event manager for the widget.

◆ getSoEventManager()

SoEventManager * QuarterWidget::getSoEventManager ( void  ) const

Returns a pointer to the event manager.

◆ setSoRenderManager()

void QuarterWidget::setSoRenderManager ( SoRenderManager manager)

Set the render manager for the widget.

◆ getSoRenderManager()

SoRenderManager * QuarterWidget::getSoRenderManager ( void  ) const

Returns a pointer to the render manager.

◆ getEventFilter()

EventFilter * QuarterWidget::getEventFilter ( void  ) const

Returns a pointer to the event filter.

◆ addStateMachine()

void QuarterWidget::addStateMachine ( SoScXMLStateMachine statemachine)

Convenience method that adds a state machine to the current SoEventManager. It also initializes the scene graph root and active camera for the state machine, and finally it sets up the default Quarter cursor handling.

See also
removeStateMachine

◆ removeStateMachine()

void QuarterWidget::removeStateMachine ( SoScXMLStateMachine statemachine)

Convenience method that removes a state machine from the current SoEventManager.

See also
addStateMachine

◆ processSoEvent()

bool QuarterWidget::processSoEvent ( const SoEvent event)
virtual

Passes an event to the event manager.

Parameters
[in]eventto pass
Return values
Returnstrue if the event was successfully processed

◆ minimumSizeHint()

QSize QuarterWidget::minimumSizeHint ( void  ) const
virtual

See QWidget::minimumSizeHint

◆ transparencyTypeActions()

QList< QAction * > QuarterWidget::transparencyTypeActions ( void  ) const

Returns a list of grouped actions that corresponds to the TransparencyType enum. If you want to create a menu in your application that controls the transparency type used in QuarterWidget, add these actions to the menu.

◆ stereoModeActions()

QList< QAction * > QuarterWidget::stereoModeActions ( void  ) const

Returns a list of grouped actions that corresponds to the StereoMode enum. If you want to create a menu in your application that controls the stereo mode used in QuarterWidget, add these actions to the menu.

◆ renderModeActions()

QList< QAction * > QuarterWidget::renderModeActions ( void  ) const

Returns a list of grouped actions that corresponds to the RenderMode enum. If you want to create a menu in your application that controls the render mode type used in QuarterWidget, add these actions to the menu.

◆ viewAll

void QuarterWidget::viewAll ( void  )
virtualslot

Reposition the current camera to display the entire scene.

◆ seek

void QuarterWidget::seek ( void  )
virtualslot

Sets the current camera in seek mode, if supported by the underlying navigation system. Camera typically seeks towards what the mouse is pointing at.

◆ redraw

void QuarterWidget::redraw ( void  )
slot

Used for rendering the scene. Usually Coin/Quarter will automatically redraw the scene graph at regular intervals, after the scene is modified.

However, if you want to disable this functionality and gain full control over when the scene is rendered yourself, you can turn off autoredraw in the render manager and render the scene by calling this method.

◆ setRenderMode

void QuarterWidget::setRenderMode ( RenderMode  mode)
slot

Sets how rendering of primitives is done.

See SoRenderManager::RenderMode for a full description of the modes

◆ setStereoMode

void QuarterWidget::setStereoMode ( StereoMode  mode)
slot

Sets how stereo rendering is performed.

See SoRenderManager::StereoMode for a full description of the modes

◆ setTransparencyType

void QuarterWidget::setTransparencyType ( TransparencyType  type)
slot

Sets the transparency type to be used for the scene.

◆ resizeGL()

void QuarterWidget::resizeGL ( int  width,
int  height 
)
protectedvirtual

Overridden from QGLWidget to resize the Coin scene graph.

◆ initializeGL()

void QuarterWidget::initializeGL ( void  )
protectedvirtual

This function will be called whenever the GLContext changes, for instance when the widget is reparented.

Overridden from QGLWidget to enable OpenGL depth buffer and reinitialize the SoRenderManager.

◆ paintGL()

void QuarterWidget::paintGL ( void  )
protectedvirtual

Overridden from QGLWidget to render the scene graph.

◆ actualRedraw()

void QuarterWidget::actualRedraw ( void  )
protectedvirtual

Overridden from QGLWidget to render the scene graph.

Property Documentation

◆ navigationModeFile

QuarterWidget::navigationModeFile
readwrite

An URL to a navigation mode file which is a scxml file which defines the possible states for the Coin navigation system

Supports:

  • coin for internal Coin resources
  • file for file system path to resources
See also
scxml

◆ backgroundColor

QuarterWidget::backgroundColor
readwrite

Set background color to a given QColor

Remember that QColors are given in integers between 0 and 255, as opposed to SbColor4f which is in [0, 1]. The default alpha value for a QColor is 255, but you'll probably want to set it to zero before using it as an OpenGL clear color.

◆ contextMenuEnabled

QuarterWidget::contextMenuEnabled
readwrite

Controls the display of the context menu

Parameters
[in]yesContext menu on?

◆ headlightEnabled

QuarterWidget::headlightEnabled
readwrite

Enable/disable the headlight. This will toggle the SoDirectionalLight::on field (returned from getHeadlight()).

◆ clearZBuffer

QuarterWidget::clearZBuffer
readwrite

Specify if you want the z-buffer to be cleared before redraw. This is on by default.

◆ clearWindow

QuarterWidget::clearWindow
readwrite

Specify if you want the rendering buffer to be cleared before rendering. This is on by default.

◆ interactionModeEnabled

QuarterWidget::interactionModeEnabled
readwrite

Enable/disable interaction mode.

Specifies whether you may use the Alt-key to enter interaction mode.

◆ interactionModeOn

QuarterWidget::interactionModeOn
readwrite

Turn interaction mode on or off.

◆ transparencyType

QuarterWidget::transparencyType
readwrite

Sets the transparency type to be used for the scene.

◆ renderMode

QuarterWidget::renderMode
readwrite

Sets how rendering of primitives is done.

See SoRenderManager::RenderMode for a full description of the modes

◆ stereoMode

QuarterWidget::stereoMode
readwrite

Sets how stereo rendering is performed.

See SoRenderManager::StereoMode for a full description of the modes


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