Quarter  1.2.2
Coin3D GUI binding for Qt
Loading...
Searching...
No Matches
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  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
}
 
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
}
 

Public Slots

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

Signals

void devicePixelRatioChanged (qreal dev_pixel_ratio)
 

Public Member Functions

 QuarterWidget (const QGLFormat &format, 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 (QWidget *parent=0, const QGLWidget *sharewidget=0, Qt::WindowFlags f=0)
 
virtual ~QuarterWidget ()
 
void addStateMachine (SoScXMLStateMachine *statemachine)
 
QColor backgroundColor (void) const
 
bool clearWindow (void) const
 
bool clearZBuffer (void) const
 
bool contextMenuEnabled (void) const
 
qreal devicePixelRatio (void) const
 
uint32_t getCacheContextId (void) const
 
QMenu * getContextMenu (void) const
 
EventFiltergetEventFilter (void) const
 
SoDirectionalLight * getHeadlight (void)
 
virtual SoNode * getSceneGraph (void) const
 
SoEventManager * getSoEventManager (void) const
 
SoRenderManager * getSoRenderManager (void) const
 
bool headlightEnabled (void) const
 
bool interactionModeEnabled (void) const
 
bool interactionModeOn (void) const
 
virtual QSize minimumSizeHint (void) const
 
const QUrl & navigationModeFile (void) const
 
virtual bool processSoEvent (const SoEvent *event)
 
void removeStateMachine (SoScXMLStateMachine *statemachine)
 
RenderMode renderMode (void) const
 
QList< QAction * > renderModeActions (void) const
 
void resetNavigationModeFile (void)
 
void setBackgroundColor (const QColor &color)
 
void setClearWindow (bool onoff)
 
void setClearZBuffer (bool onoff)
 
void setContextMenuEnabled (bool yes)
 
void setHeadlightEnabled (bool onoff)
 
void setInteractionModeEnabled (bool onoff)
 
void setInteractionModeOn (bool onoff)
 
void setNavigationModeFile (const QUrl &url=QUrl(DEFAULT_NAVIGATIONFILE))
 
virtual void setSceneGraph (SoNode *root)
 
void setSoEventManager (SoEventManager *manager)
 
void setSoRenderManager (SoRenderManager *manager)
 
void setStateCursor (const SbName &state, const QCursor &cursor)
 
void setupDefaultCursors ()
 Sets up the default cursors for the widget.
 
QCursor stateCursor (const SbName &state)
 
StereoMode stereoMode (void) const
 
QList< QAction * > stereoModeActions (void) const
 
TransparencyType transparencyType (void) const
 
QList< QAction * > transparencyTypeActions (void) const
 

Protected Member Functions

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

Properties

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

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

◆ 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

◆ 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

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

◆ actualRedraw()

void QuarterWidget::actualRedraw ( void )
protectedvirtual

Overridden from QGLWidget to render the scene graph.

◆ 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

◆ getCacheContextId()

uint32_t QuarterWidget::getCacheContextId ( void ) const

Returns the Coin cache context id for this widget.

◆ getContextMenu()

QMenu * QuarterWidget::getContextMenu ( void ) const

Returns the context menu used by the widget.

◆ getEventFilter()

EventFilter * QuarterWidget::getEventFilter ( void ) const

Returns a pointer to the event filter.

◆ getHeadlight()

SoDirectionalLight * QuarterWidget::getHeadlight ( void )

Returns the light used for the headlight.

◆ getSceneGraph()

SoNode * QuarterWidget::getSceneGraph ( void ) const
virtual

Returns pointer to root of scene graph.

◆ getSoEventManager()

SoEventManager * QuarterWidget::getSoEventManager ( void ) const

Returns a pointer to the event manager.

◆ getSoRenderManager()

SoRenderManager * QuarterWidget::getSoRenderManager ( void ) const

Returns a pointer to the render manager.

◆ 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.

◆ minimumSizeHint()

QSize QuarterWidget::minimumSizeHint ( void ) const
virtual

See QWidget::minimumSizeHint

◆ paintGL()

void QuarterWidget::paintGL ( void )
protectedvirtual

Overridden from QGLWidget to render the scene graph.

◆ 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

◆ 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.

◆ removeStateMachine()

void QuarterWidget::removeStateMachine ( SoScXMLStateMachine * statemachine)

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

See also
addStateMachine

◆ 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.

◆ resetNavigationModeFile()

void QuarterWidget::resetNavigationModeFile ( void )

Removes any navigationModeFile set.

◆ resizeGL()

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

Overridden from QGLWidget to resize the Coin scene graph.

◆ 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.

◆ 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.

◆ setClearWindow()

void QuarterWidget::setClearWindow ( bool onoff)

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

◆ setClearZBuffer()

void QuarterWidget::setClearZBuffer ( bool onoff)

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

◆ setContextMenuEnabled()

void QuarterWidget::setContextMenuEnabled ( bool yes)

Controls the display of the context menu

Parameters
[in]yesContext menu on?

◆ setHeadlightEnabled()

void QuarterWidget::setHeadlightEnabled ( bool onoff)

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

◆ setInteractionModeEnabled()

void QuarterWidget::setInteractionModeEnabled ( bool onoff)

Enable/disable interaction mode.

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

◆ setInteractionModeOn()

void QuarterWidget::setInteractionModeOn ( bool onoff)

Turn interaction mode on or off.

◆ 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

◆ setRenderMode

void QuarterWidget::setRenderMode ( RenderMode mode)
slot

Sets how rendering of primitives is done.

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

◆ setSceneGraph()

void QuarterWidget::setSceneGraph ( SoNode * node)
virtual

Sets the Inventor scene graph to be rendered.

◆ setSoEventManager()

void QuarterWidget::setSoEventManager ( SoEventManager * manager)

Set the Coin event manager for the widget.

◆ setSoRenderManager()

void QuarterWidget::setSoRenderManager ( SoRenderManager * manager)

Set the render manager for the widget.

◆ 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.

◆ 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.

◆ 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

◆ 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.

◆ 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.

◆ viewAll

void QuarterWidget::viewAll ( void )
virtualslot

Reposition the current camera to display the entire scene.

Property Documentation

◆ backgroundColor

QColor 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.

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

◆ clearWindow

bool QuarterWidget::clearWindow
readwrite

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

Returns true if the rendering buffer is cleared before rendering.

◆ clearZBuffer

bool QuarterWidget::clearZBuffer
readwrite

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

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

◆ contextMenuEnabled

QuarterWidget::contextMenuEnabled
readwrite
Return values
Iscontext menu enabled?

Controls the display of the context menu

Parameters
[in]yesContext menu on?

◆ devicePixelRatio

qreal QuarterWidget::devicePixelRatio
read

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).

◆ headlightEnabled

bool QuarterWidget::headlightEnabled
readwrite

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

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

◆ interactionModeEnabled

bool QuarterWidget::interactionModeEnabled
readwrite

Enable/disable interaction mode.

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

Returns true if interaction mode is enabled, false otherwise.

◆ interactionModeOn

bool QuarterWidget::interactionModeOn
readwrite

Turn interaction mode on or off.

Returns true if interaction mode is on.

◆ navigationModeFile

const QUrl & 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
Return values
Thecurrent navigation mode file

◆ renderMode

QuarterWidget::RenderMode QuarterWidget::renderMode
readwrite

Sets how rendering of primitives is done.

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

Return values
Thecurrent RenderMode

◆ stereoMode

QuarterWidget::StereoMode QuarterWidget::stereoMode
readwrite

Sets how stereo rendering is performed.

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

Return values
Thecurrent StereoMode

◆ transparencyType

QuarterWidget::TransparencyType QuarterWidget::transparencyType
readwrite

Sets the transparency type to be used for the scene.

Return values
Thecurrent TransparencyType

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