Coin Logo http://www.sim.no
http://www.coin3d.org

SoQtRenderArea Class Reference
[Qt ComponentsQt Viewer Components]

#include <Inventor/Qt/SoQtRenderArea.h>

Inheritance diagram for SoQtRenderArea:

SoQtGLWidget SoQtComponent SoQtObject SoQtViewer SoQtFullViewer SoQtConstrainedViewer SoQtExaminerViewer SoQtPlaneViewer SoQtFlyViewer List of all members.

Detailed Description

The SoQtRenderArea class adds scenegraph handling and event management.

The SoQtRenderArea class is a component that adds scenegraph management and input device event handling to the SoQtGLWidget component.

The class has many convenient methods for controlling aspects of the rendering, like for instance transparency, aliasing and for scheduling of redraws.

Native toolkit events are caught by SoQtRenderArea components, translated to Coin SoEvent instances and passed on to the scenegraph, in case the user is doing interactive operations on for instance Coin geometry draggers.

SoQtRenderArea is the first non-abstract component in it's inheritance hierarchy that you can use directly from client application code to set up a scenegraph viewer canvas.

For an SoQtRenderArea component to properly display your scenegraph, it must contain an SoCamera-derived node and at least one SoLight-derived lightsource node.

Here's a complete, stand-alone example on how to set up an SoQtRenderArea with a scenegraph:

  #include <Inventor/Qt/SoQt.h>
  #include <Inventor/Qt/SoQtRenderArea.h>
  
  #include <Inventor/nodes/SoCube.h>
  #include <Inventor/nodes/SoRotor.h>
  #include <Inventor/nodes/SoArray.h>
  #include <Inventor/nodes/SoDirectionalLight.h>
  #include <Inventor/nodes/SoPerspectiveCamera.h>
  #include <Inventor/nodes/SoSeparator.h>
  
  // Set up a simple scenegraph, just for demonstration purposes.
  static SoSeparator *
  get_scene_graph(void)
  {
    SoSeparator * root = new SoSeparator;
  
    SoGroup * group = new SoGroup;
  
    SoRotor * rotor = new SoRotor;
    rotor->rotation = SbRotation(SbVec3f(0.2, 0.5, 0.9), M_PI/4.0);
    group->addChild(rotor);
  
    SoCube * cube = new SoCube;
    group->addChild(cube);
  
    SoArray * array = new SoArray;
    array->origin = SoArray::CENTER;
    array->addChild(group);
    array->numElements1 = 2;
    array->numElements2 = 2;
    array->separation1 = SbVec3f(4, 0, 0);
    array->separation2 = SbVec3f(0, 4, 0);
  
    root->addChild(array);
    return root;
  }
  
  int
  main(int argc, char ** argv)
  {
    QWidget * window = SoQt::init(argv[0]);
  
    SoSeparator * root = new SoSeparator;
    root->ref();
  
    SoPerspectiveCamera * camera;
    root->addChild(camera = new SoPerspectiveCamera);
  
    root->addChild(new SoDirectionalLight);
  
    SoSeparator * userroot = get_scene_graph();
    root->addChild(userroot);
  
    SoQtRenderArea * renderarea = new SoQtRenderArea(window);
    camera->viewAll(userroot, renderarea->getViewportRegion());
    renderarea->setSceneGraph(root);
    renderarea->setBackgroundColor(SbColor(0.0f, 0.2f, 0.3f));
    if (argc > 1) {
      renderarea->setTitle(argv[1]);
      renderarea->setIconTitle(argv[1]);
    }
    renderarea->show();
  
    SoQt::show(window);
    SoQt::mainLoop();
  
    delete renderarea;
    root->unref();
  
    return 0;
  }


Public Member Functions

 SoQtRenderArea (QWidget *parent=NULL, const char *name=NULL, SbBool embed=TRUE, SbBool mouseInput=TRUE, SbBool keyboardInput=TRUE)
 ~SoQtRenderArea ()
virtual void setSceneGraph (SoNode *scene)
virtual SoNode * getSceneGraph (void)
void setOverlaySceneGraph (SoNode *scene)
SoNode * getOverlaySceneGraph (void)
void setBackgroundColor (const SbColor &color)
const SbColor & getBackgroundColor (void) const
void setBackgroundIndex (int idx)
int getBackgroundIndex (void) const
void setOverlayBackgroundIndex (int idx)
int getOverlayBackgroundIndex (void) const
void setColorMap (int start, int num, const SbColor *colors)
void setOverlayColorMap (int start, int num, const SbColor *colors)
void setViewportRegion (const SbViewportRegion &newRegion)
const SbViewportRegion & getViewportRegion (void) const
void setTransparencyType (SoGLRenderAction::TransparencyType type)
SoGLRenderAction::TransparencyType getTransparencyType (void) const
void setAntialiasing (SbBool smoothing, int numPasses)
void getAntialiasing (SbBool &smoothing, int &numPasses) const
void setClearBeforeRender (SbBool enable, SbBool zbEnable=TRUE)
SbBool isClearBeforeRender (void) const
SbBool isClearZBufferBeforeRender (void) const
void setClearBeforeOverlayRender (SbBool enable)
SbBool isClearBeforeOverlayRender (void) const
void setAutoRedraw (SbBool enable)
SbBool isAutoRedraw (void) const
void setRedrawPriority (uint32_t priority)
uint32_t getRedrawPriority (void) const
void render (void)
void renderOverlay (void)
void scheduleRedraw (void)
void scheduleOverlayRedraw (void)
void redrawOnSelectionChange (SoSelection *selection)
void redrawOverlayOnSelectionChange (SoSelection *selection)
void setEventCallback (SoQtRenderAreaEventCB *func, void *user=NULL)
void setSceneManager (SoSceneManager *manager)
SoSceneManager * getSceneManager (void) const
void setOverlaySceneManager (SoSceneManager *manager)
SoSceneManager * getOverlaySceneManager (void) const
void setGLRenderAction (SoGLRenderAction *action)
SoGLRenderAction * getGLRenderAction (void) const
void setOverlayGLRenderAction (SoGLRenderAction *action)
SoGLRenderAction * getOverlayGLRenderAction (void) const
SbBool sendSoEvent (const SoEvent *event)
void registerDevice (SoQtDevice *device)
void unregisterDevice (SoQtDevice *device)

Static Public Member Functions

static uint32_t getDefaultRedrawPriority (void)

Protected Member Functions

 SoQtRenderArea (QWidget *parent, const char *name, SbBool embed, SbBool mouseInput, SbBool keyboardInput, SbBool build)
virtual void redraw (void)
virtual void actualRedraw (void)
virtual void redrawOverlay (void)
virtual void actualOverlayRedraw (void)
virtual SbBool processSoEvent (const SoEvent *const event)
virtual void processEvent (QEvent *event)
virtual void initGraphic (void)
virtual void initOverlayGraphic (void)
virtual void sizeChanged (const SbVec2s &size)
virtual void widgetChanged (QWidget *widget)
virtual void afterRealizeHook (void)
QWidget * buildWidget (QWidget *parent)
virtual const char * getDefaultWidgetName (void) const
virtual const char * getDefaultTitle (void) const
virtual const char * getDefaultIconTitle (void) const
virtual SbBool glScheduleRedraw (void)

Friends

class SoQtRenderAreaP


Constructor & Destructor Documentation

SoQtRenderArea::SoQtRenderArea QWidget *  parent = NULL,
const char *  name = NULL,
SbBool  embed = TRUE,
SbBool  mouseInput = TRUE,
SbBool  keyboardInput = TRUE
 

Public constructor.

SoQtRenderArea::~SoQtRenderArea  ) 
 

Destructor.

SoQtRenderArea::SoQtRenderArea QWidget *  parent,
const char *  name,
SbBool  embed,
SbBool  mouseInput,
SbBool  keyboardInput,
SbBool  build
[protected]
 

Protected constructor used by derived classes.


Member Function Documentation