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 >
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
}
void devicePixelRatioChanged (qreal dev_pixel_ratio)
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);
}
◆ 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
◆ QuarterWidget() [1/3]
QuarterWidget::QuarterWidget
(
QWidget * parent = 0 ,
const QGLWidget * sharewidget = 0 ,
Qt::WindowFlags f = 0 )
explicit
◆ QuarterWidget() [2/3]
QuarterWidget::QuarterWidget
(
QGLContext * context ,
QWidget * parent = 0 ,
const QGLWidget * sharewidget = 0 ,
Qt::WindowFlags f = 0 )
explicit
◆ QuarterWidget() [3/3]
QuarterWidget::QuarterWidget
(
const QGLFormat & format ,
QWidget * parent = 0 ,
const QGLWidget * sharewidget = 0 ,
Qt::WindowFlags f = 0 )
explicit
◆ ~QuarterWidget()
QuarterWidget::~QuarterWidget
(
)
virtual
◆ actualRedraw()
void QuarterWidget::actualRedraw
(
void )
protected virtual
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 )
protected virtual
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 )
protected virtual
Overridden from QGLWidget to render the scene graph.
◆ processSoEvent()
bool QuarterWidget::processSoEvent
(
const SoEvent * event )
virtual
Passes an event to the event manager.
Parameters
Return values
Returns true 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 )
protected virtual
Overridden from QGLWidget to resize the Coin scene graph.
◆ seek
void QuarterWidget::seek
(
void )
virtual slot
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
◆ 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] url URL 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
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] state Named state in the state machine
Return values
Cursor corresponding 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 )
virtual slot
Reposition the current camera to display the entire scene.
◆ backgroundColor
QColor QuarterWidget::backgroundColor
read write
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
read write
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
read write
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
read write
Return values
Controls the display of the context menu
Parameters
◆ 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
read write
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
read write
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
read write
Turn interaction mode on or off.
Returns true if interaction mode is on.
◆ navigationModeFile
const QUrl & QuarterWidget::navigationModeFile
read write
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
The current navigation mode file
◆ renderMode
Sets how rendering of primitives is done.
See SoRenderManager::RenderMode for a full description of the modes
Return values
◆ stereoMode
Sets how stereo rendering is performed.
See SoRenderManager::StereoMode for a full description of the modes
Return values
◆ transparencyType
Sets the transparency type to be used for the scene.
Return values
The documentation for this class was generated from the following files: