Routines for Open Inventor/Qt compatibility. More...
#include <Inventor/Qt/SoQt.h>
Static Public Member Functions | |
static SoNONUNICODE QWidget * | init (const char *appName, const char *className="Inventor") |
static QWidget * | init (const SbString &appName, const SbString &className="Inventor") |
static void | init (QWidget *topLevelWidget) |
static void | show (QWidget *widget) |
static void | hide (QWidget *widget) |
static int | mainLoop () |
static void | exit (int returnCode=0) |
static void | nextEvent (XtAppContext appContext, XEvent *event) |
static SbGlContextHelper::Display | getDisplay () |
static SbGlContextHelper::GLContext | getAppContext () |
static Boolean | dispatchEvent (XEvent *) |
static QWidget * | getTopLevelWidget () |
static void | setWidgetSize (QWidget *widget, const SbVec2s &size) |
static SbVec2s | getWidgetSize (QWidget *widget) |
static SoNONUNICODE void | createSimpleErrorDialog (QWidget *widget, char *dialogTitle, char *errorStr1, char *errorStr2=NULL) |
static void | createSimpleErrorDialog (QWidget *widget, const SbString &sdialogTitle, const SbString &errorStr1, const SbString &errorStr2="") |
static void | finish () |
static bool | isInitialized () |
static int | getExtensionEventNumber () |
Deprecated | |
| |
SoDEPRECATED static SoNONUNICODE QWidget * | threadInit (const char *appName, const char *className="Inventor") |
static SoDEPRECATED QWidget * | threadInit (const SbString &appName, const SbString &className="Inventor") |
static SoDEPRECATED void | threadInit (QWidget *topLevelWidget) |
The SoQt class initializes Open Inventor for use with Qt. SoQt::init() must be called in order for Open Inventor to work properly with Qt. SoQt::finish() should be called to clean up static memory allocations.
SoQt::mainLoop() must be called in order for extension device messages to be passed to Open Inventor render areas. The other methods are convenience functions.
Refer to the SoQtComponent reference pages for examples on how this class should be used when using Open Inventor Qt components.
QtCustomViewer, QtHelloCone, QtMultiViewer, QtReadFile, QtSpaceMouse, QtTreeView
static void SoQt::createSimpleErrorDialog | ( | QWidget * | widget, | |
const SbString & | sdialogTitle, | |||
const SbString & | errorStr1, | |||
const SbString & | errorStr2 = "" | |||
) | [static] |
Convenience routine which brings a simple Qt error dialog box displaying the given error string(s) and window title.
The OK button, which destroys the dialog, is the only button displayed.
static SoNONUNICODE void SoQt::createSimpleErrorDialog | ( | QWidget * | widget, | |
char * | dialogTitle, | |||
char * | errorStr1, | |||
char * | errorStr2 = NULL | |||
) | [static] |
Convenience routine which brings a simple Qt error dialog box displaying the given error string(s) and window title.
The OK button, which destroys the dialog, is the only button displayed.
This method is included for portability only.
It processes all the pending events So that code written for Xt can be used also on Qt implementations.
static void SoQt::exit | ( | int | returnCode = 0 |
) | [static] |
Tells the main event loop to exit with a return code.
After this function has been called, the mainLoop() function returns returnCode. If the event loop is not running, this function does nothing.
By convention, a returnCode of 0 means success, and any non-zero value indicates an error.
static void SoQt::finish | ( | ) | [static] |
Frees Open Inventor's internal static memory allocations.
This avoids false positives from memory leak checking software. We recommend calling this method and it should be the last Open Inventor method called by the application. This method calls SoDB::finish(), SoNodeKit::finish(), and SoInteraction::finish().
Note: Open Inventor objects should be destroyed before you call this method.
For example:
Wrong Open Inventor Ending | Safe Open Inventor Endings | ||
void main() { QWidget myW = SoQt::init(""); SoQtExaminerViewer viewer( myW ); .... .... SoQt::mainLoop(); SoQt::finish(); } |
| ||
SoQt doesn't end properly: SoQtExaminerViewer is destroyed after the finish() method has been called. | The SoQtExaminerViewer (that uses Open Inventor) is destroyed before calling the finish() method. |
static SbGlContextHelper::GLContext SoQt::getAppContext | ( | ) | [static] |
This method is included for portability only.
So that code written for Xt can be used also on Qt implementations.
static SbGlContextHelper::Display SoQt::getDisplay | ( | ) | [static] |
This method is included for portability only.
static int SoQt::getExtensionEventNumber | ( | ) | [static] |
Returns the type number of the Open Inventor extension QCustomEvent.
This number can be set with the environment variable OIV_EXTENSION_EVENT_NUMBER.
static QWidget* SoQt::getTopLevelWidget | ( | ) | [static] |
Returns information based on the initial QWidget handle returned by or passed to init.
static SbVec2s SoQt::getWidgetSize | ( | QWidget * | widget | ) | [static] |
Convenience routine to get the size of the given widget.
static void SoQt::hide | ( | QWidget * | widget | ) | [static] |
Convenience routine to hide the passed widget handle.
This includes any children the widget may have.
static void SoQt::init | ( | QWidget * | topLevelWidget | ) | [static] |
This alternate form of init allows the application to initialize Qt.
The passed widget handle should be the top level widget handle returned from the Qt initialization. This method will call SoDB::init(), SoNodeKit::init(), and SoInteraction::init().
static QWidget* SoQt::init | ( | const SbString & | appName, | |
const SbString & | className = "Inventor" | |||
) | [static] |
This is called to initialize Open Inventor and Qt, and bind Open Inventor with Qt message handling so that Open Inventor sensors will work correctly.
This returns the top level shell widget handle. This method calls SoDB::init(), SoNodeKit::init(), and SoInteraction::init(), and creates an initial window.
static SoNONUNICODE QWidget* SoQt::init | ( | const char * | appName, | |
const char * | className = "Inventor" | |||
) | [static] |
This is called to initialize Open Inventor and Qt, and bind Open Inventor with Qt message handling so that Open Inventor sensors will work correctly.
This returns the top level shell widget handle. This method calls SoDB::init(), SoNodeKit::init(), and SoInteraction::init(), and creates an initial window.
static bool SoQt::isInitialized | ( | ) | [static] |
Returns TRUE if SoQt module is currently initialized.
static int SoQt::mainLoop | ( | ) | [static] |
Enters the main event loop and waits until exit() is called or QCoreApplication::exit() is called.
Returns the value that was passed to exit() or QCoreApplication::exit().
It calls nextEvent() and dispatchEvent() to retrieve and dispatch events.
static void SoQt::nextEvent | ( | XtAppContext | appContext, | |
XEvent * | event | |||
) | [static] |
This method is included for portability only.
So that code written for Xt can be used also on Qt implementations.
static void SoQt::setWidgetSize | ( | QWidget * | widget, | |
const SbVec2s & | size | |||
) | [static] |
Convenience routine to set the size of the given widget.
static void SoQt::show | ( | QWidget * | widget | ) | [static] |
Convenience routine to show the passed widget handle.
This includes any children the widget may have.
static SoDEPRECATED void SoQt::threadInit | ( | QWidget * | topLevelWidget | ) | [static] |
static SoDEPRECATED QWidget* SoQt::threadInit | ( | const SbString & | appName, | |
const SbString & | className = "Inventor" | |||
) | [static] |
SoDEPRECATED static SoNONUNICODE QWidget* SoQt::threadInit | ( | const char * | appName, | |
const char * | className = "Inventor" | |||
) | [static] |