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

SoQt Documentation

1.5.0

SoQt is a library which provides the glue between Systems in Motion's Coin high-level 3D visualization library and Troll Tech's Qt 2D user interface library.

Qt is a C++ toolkit for multiplatform development of 2D user interfaces, and also includes other functionality to help programmers write multiplatform applications. Qt is currently available on X11-based systems (UNIX, Linux and BSDs), MSWindows, Mac OS X and embedded systems.

For more information on the Qt toolkit, see the web site for Troll Tech (makers of Qt): <http://www.trolltech.com>.

By using the combination of Coin, Qt and SoQt for your 3D applications, you have a framework for writing completely portable software across the whole range of UNIX, Linux, Microsoft Windows and Mac OS X operating systems. Coin, Qt and SoQt makes this possible from a 100% common codebase, which means there is a minimum of hassle for developers when working on multiplatform software, with the resulting large gains in productivity.

SoQt, like Coin and Qt, provides the programmer with a high-level application programmer's interface (API) in C++. The library primarily includes a class-hierarchy of viewer components of varying functionality and complexity, with various modes for the end-user to control the 3D-scene camera interaction.

For a small, completely stand-alone usage example on how to initialize the library and set up a viewer instance window, see the following code:

  #include <Inventor/Qt/SoQt.h>
  #include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
  #include <Inventor/nodes/SoBaseColor.h>
  #include <Inventor/nodes/SoCone.h>
  #include <Inventor/nodes/SoSeparator.h>

  int
  main(int argc, char ** argv)
  {
    // Initializes SoQt library (and implicitly also the Coin and Qt
    // libraries). Returns a top-level / shell Qt window to use.
    QWidget * mainwin = SoQt::init(argc, argv, argv[0]);

    // Make a dead simple scene graph by using the Coin library, only
    // containing a single yellow cone under the scenegraph root.
    SoSeparator * root = new SoSeparator;
    root->ref();

    SoBaseColor * col = new SoBaseColor;
    col->rgb = SbColor(1, 1, 0);
    root->addChild(col);

    root->addChild(new SoCone);

    // Use one of the convenient SoQt viewer classes.
    SoQtExaminerViewer * eviewer = new SoQtExaminerViewer(mainwin);
    eviewer->setSceneGraph(root);
    eviewer->show();

    // Pop up the main window.
    SoQt::show(mainwin);
    // Loop until exit.
    SoQt::mainLoop();

    // Clean up resources.
    delete eviewer;
    root->unref();

    return 0;
  }

As compiled and run, this example provides the end-user with a full fledged 3D viewer. The viewer automatically contains mouse interaction handling logic to let the end-user "examine" the 3D-model / scene (since this is the SoQtExaminerViewer class), plus toolbar controls on the right-side decorations border for often used controls:

sogui-class-example.png

The SoQt library contains several such high-level classes as the SoQtExaminerViewer used in the above example. These are primarily used for doing Rapid Application Development (RAD) of new concepts and ideas for your 3D system. The "real" application will typically use one of the lower-complexity classes higher up in the inheritance hierarchy, such as the SoQtRenderArea, which provides the application programmer with full control over the user interface components and general layout to present for the end-user, as suitable for the specific application needs.

This is how the SoQt library fits in with the other system components:

soqt-boxology.png

As can be seen from the above figure, SoQt builds on Systems in Motion's Coin library for the 3D graphics, and Troll Tech's Qt library for the 2D user interface components and the OpenGL canvas binding.

The additional functionality provided by SoQt over Coin and Qt is:


Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Fri Jan 27 14:16:00 2012 for SoQt by Doxygen 1.6.3.