Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoQt Class Reference

VSG extension Routines for Open Inventor/Qt compatibility. More...

#include <Inventor/Qt/SoQt.h>

+ Inheritance diagram for SoQt:

Static Public Member Functions

static SoNONUNICODE QWidget * init (const char *appName, const char *className="Inventor")
 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.
 
static QWidget * init (const SbString &appName, const SbString &className="Inventor")
 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.
 
static void init (QWidget *topLevelWidget)
 This alternate form of init allows the application to initialize Qt.
 
static void show (QWidget *widget)
 Convenience routine to show the passed widget handle.
 
static void hide (QWidget *widget)
 Convenience routine to hide the passed widget handle.
 
static int mainLoop ()
 Enters the main event loop and waits until exit() is called or QCoreApplication::exit() is called.
 
static void exit (int returnCode=0)
 Tells the main event loop to exit with a return code.
 
static void nextEvent (XtAppContext appContext, XEvent *event)
 This method is included for portability only.
 
static SbGlContextHelper::Display getDisplay ()
 This method is included for portability only.
 
static SbGlContextHelper::GLContext getAppContext ()
 This method is included for portability only.
 
static Boolean dispatchEvent (XEvent *)
 This method is included for portability only.
 
static QWidget * getTopLevelWidget ()
 Returns information based on the initial QWidget handle returned by or passed to init.
 
static void setWidgetSize (QWidget *widget, const SbVec2s &size)
 Convenience routine to set the size of the given widget.
 
static SbVec2s getWidgetSize (QWidget *widget)
 Convenience routine to get the size of the given widget.
 
static SoNONUNICODE void createSimpleErrorDialog (QWidget *widget, char *dialogTitle, char *errorStr1, char *errorStr2=NULL)
 Convenience routine which brings a simple Qt error dialog box displaying the given error string(s) and window title.
 
static void createSimpleErrorDialog (QWidget *widget, const SbString &sdialogTitle, const SbString &errorStr1, const SbString &errorStr2="")
 Convenience routine which brings a simple Qt error dialog box displaying the given error string(s) and window title.
 
static void finish ()
 Frees Open Inventor's internal static memory allocations.
 
static bool isInitialized ()
 Returns TRUE if SoQt module is currently initialized.
 
static int getExtensionEventNumber ()
 Returns the type number of the Open Inventor extension QCustomEvent.
 
Deprecated
SoDEPRECATED static SoNONUNICODE QWidget * threadInit (const char *appName, const char *className="Inventor")
 Non Unicode: This function should not be used in a Unicode application.
 
static SoDEPRECATED QWidget * threadInit (const SbString &appName, const SbString &className="Inventor")
 
static SoDEPRECATED void threadInit (QWidget *topLevelWidget)
 

Detailed Description

VSG extension Routines for Open Inventor/Qt compatibility.

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.

SEE ALSO

SoQtComponent

Definition at line 89 of file SoQt.h.

Member Function Documentation

◆ createSimpleErrorDialog() [1/2]

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.

Non Unicode: This function should not be used in a Unicode application.

◆ createSimpleErrorDialog() [2/2]

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.

◆ dispatchEvent()

static Boolean SoQt::dispatchEvent ( XEvent )
static

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.

◆ exit()

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.

◆ finish()

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 );
....
....
}
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Viewer component...
static int mainLoop()
Enters the main event loop and waits until exit() is called or QCoreApplication::exit() is called.
static SoNONUNICODE QWidget * init(const char *appName, const char *className="Inventor")
This is called to initialize Open Inventor and Qt, and bind Open Inventor with Qt message handling so...
static void finish()
Frees Open Inventor's internal static memory allocations.

void runApp() {
SoQtExaminerViewer viewer( myW );
....
....
}
void main () {
QWidget myW = SoQt::init("");
runApp();
}

void main () {
QWidget myW = SoQt::init("");
= new SoQtExaminerViewer( myW );
....
....
delete viewer;
}

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.

◆ getAppContext()

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.

◆ getDisplay()

static SbGlContextHelper::Display SoQt::getDisplay ( )
static

This method is included for portability only.

◆ getExtensionEventNumber()

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.

◆ getTopLevelWidget()

static QWidget * SoQt::getTopLevelWidget ( )
static

Returns information based on the initial QWidget handle returned by or passed to init.

◆ getWidgetSize()

static SbVec2s SoQt::getWidgetSize ( QWidget *  widget)
static

Convenience routine to get the size of the given widget.

◆ hide()

static void SoQt::hide ( QWidget *  widget)
static

Convenience routine to hide the passed widget handle.

This includes any children the widget may have.

◆ init() [1/3]

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.

Non Unicode: This function should not be used in a Unicode application.

◆ init() [2/3]

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.

◆ init() [3/3]

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

◆ isInitialized()

static bool SoQt::isInitialized ( )
static

Returns TRUE if SoQt module is currently initialized.

◆ mainLoop()

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.

◆ nextEvent()

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.

◆ setWidgetSize()

static void SoQt::setWidgetSize ( QWidget *  widget,
const SbVec2s size 
)
static

Convenience routine to set the size of the given widget.

◆ show()

static void SoQt::show ( QWidget *  widget)
static

Convenience routine to show the passed widget handle.

This includes any children the widget may have.

◆ threadInit() [1/3]

SoDEPRECATED static SoNONUNICODE QWidget * SoQt::threadInit ( const char *  appName,
const char *  className = "Inventor" 
)
static

Non Unicode: This function should not be used in a Unicode application.

◆ threadInit() [2/3]

static SoDEPRECATED QWidget * SoQt::threadInit ( const SbString appName,
const SbString className = "Inventor" 
)
static

◆ threadInit() [3/3]

static SoDEPRECATED void SoQt::threadInit ( QWidget *  topLevelWidget)
static

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