SoQt(3)
π NAME π
okay bestie, this is the SoQt(3) manual page. The SoQt class takes care of Qt initialization and event dispatching. Thatβs the whole name-section vibe.
β¨ SYNOPSIS β¨
#include <Inventor/Qt/SoQt.h>
π Public Types π
enum FatalErrors { UNSPECIFIED_ERROR = 0, NO_OPENGL_CANVAS,
INTERNAL_ASSERT }
enum ABIType { DLL, LIB, UNKNOWN }
typedef void FatalErrorCB(const SbString errmsg, SoQt::FatalErrors
errcode, void *userdata)
πΈ Static Public Member Functions πΈ
static QWidget * init (const char *appname, const char
*classname='SoQt')
static QWidget * init (int &argc, char **argv, const char *appname,
const char *classname='SoQt')
static void init (QWidget *toplevelwidget)
static void mainLoop (void)
static void exitMainLoop (void)
static void done (void)
static QWidget * getTopLevelWidget (void)
static QWidget * getShellWidget (const QWidget *w)
static void show (QWidget *const widget)
static void hide (QWidget *const widget)
static void setWidgetSize (QWidget *const widget, const SbVec2s size)
static SbVec2s getWidgetSize (const QWidget *widget)
static void createSimpleErrorDialog (QWidget *widget, const char *title,
const char *string1, const char *string2=NULL)
static void getVersionInfo (int *major=NULL, int *minor=NULL, int
*micro=NULL)
static const char * getVersionString (void)
static const char * getVersionToolkitString (void)
static FatalErrorCB * setFatalErrorHandler (SoQt::FatalErrorCB *cb, void
*userdata)
static SbBool isDebugLibrary (void)
static SbBool isCompatible (unsigned int major, unsigned int minor)
static ABIType getABIType (void)
static void lockGL (void)
static void unlockGL (void)
thatβs the whole function roster, bestie β every single one is static, and yes, all the defaults and types are exactly as shown π
π¦ Detailed Description π¦
The SoQt class takes care of Qt initialization and event dispatching.
This is literally the βapplication-wideβ class, and itβs solely static methods handling initialization and event processing tasks. You must use this class in any application built on top of the SoQt library. no cap.
Typical usage is as follows β and yes, this is complete application 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)
{
// Initialize SoQt and Inventor API libraries. This returns a main
// window to use.
QWidget* mainwin = SoQt::init(argc, argv, argv[0]);
// Make a dead simple scene graph, only containing a single
// yellow cone under the scene graph 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 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();
SoQt::done();
return 0;
}
And voila:
See also: SoQtComponent
π Member Typedef Documentation π
π«Ά typedef void SoQt::FatalErrorCB(const SbString errmsg, SoQt::FatalErrors errcode, void *userdata)
An application function callback for handling fatal errors should be of this type. fatal is not a vibe, itβs the whole name.
The first argument is an error message in English describing the details of the error. The second argument is an error code used so the application can identify specific conditions. The third argument is the userdata pointer passed in to SoQt::setFatalErrorHandler().
π Member Enumeration Documentation π
π enum SoQt::FatalErrors π
Numerical identifiers for classifying the different kinds of possible fatal errors.
Enumerator
UNSPECIFIED_ERRORβ Signifies that we were not able to specify in any greater detail the error condition that came up. itβs giving βsomething happened, and thatβs all we knowβ πNO_OPENGL_CANVASβ Could not construct any valid OpenGL canvas. Something is very wrong on the client system.INTERNAL_ASSERTβ An internal error condition that should never happen was detected. The most likely cause of this are programming errors within the SoQt library itself.
π§ enum SoQt::ABIType π§
Numerical identifiers to identify how the library was built.
Enumerator
DLLβ The SoQt library was built as a dynamic link library (aka βsharedlibraryβ).LIBβ The SoQt library was built as a static library.UNKNOWNβ The SoQt introspection mechanisms cannot decide how the library was built.
π MEMBER FUNCTION DOCUMENTATION π
Okay bestie, this is the part where we go function by function. Grab a snack, it's giving long-but-worth-it. π
π«Ά SoQt::init β the legacy-ish one
QWidget * SoQt::init (const char * appname, const char * classname = 'SoQt') [static]
This one initializes the SoQt library and the Inventor API. The Inventor part happens by calling SoDB::init(), SoNodeKit::init() and SoInteraction::init(). All three. No skips. β¨
The QWidget* you get back is a top level shell widget for the application, and you can use it as a shell for your main component. That's literally its whole job.
Lowkey the point of this overload is easier porting / compatibility with the original SGI Inventor InventorXt library π§ β it just adds dummy argc and argv arguments and then calls the SoQt::init() method right below this one. Periodt.
π SoQt::init β the argc/argv main-character one
QWidget * SoQt::init (int & argc, char ** argv, const char * appname, const char * classname = 'SoQt') [static]
Same deal as above: initializes the SoQt library and the Inventor API, the latter by calling SoDB::init(), SoNodeKit::init() and SoInteraction::init(). π«
The extra slay here: it creates an application framework and constructs and returns a main widget for you. So you don't have to. You're welcome.
And again β the returned QWidget* is a top level shell widget for the application, usable as a shell for the main component. π
π SoQt::init β the "I already built my own stuff" one
void SoQt::init (QWidget * toplevelwidget) [static]
Yup, the library init again: SoQt plus the Inventor API, via SoDB::init(), SoNodeKit::init() and SoInteraction::init(). πΈ
This one assumes you're creating your own application framework and main widget β very DIY of you β and toplevelwidget should be your application's main widget. That's the whole vibe check.
π₯ SoQt::mainLoop
void SoQt::mainLoop (void) [static]
The event dispatch loop. The engine room. The main character energy of the whole thing. π
It does not return until application exit is somehow forced β either programmatically from the relevant API-call of the native toolkit, or when the user closes the application's main widget. It's just gonna sit there looping until somebody says stop, no cap.
After the main loop has finished execution (yes, after), call SoQt::done() to clean up static data. Don't forget, bestie. π«Ά
π¦ SoQt::exitMainLoop
void SoQt::exitMainLoop (void) [static]
This one makes the main event loop finish looping. Bye loop, it was iconic. π
NOTE: exitMainLoop() is not present in the original API for SGI's InventorXt library.
β SoQt::done
void SoQt::done (void) [static]
Cleans up all the static data the SoQt library allocated on initialization. Satisfying. π§Ή
Heads up though β this function calls SoDB::finish(), which means no Coin classes should be used after it has been called. Like, none. We mean it. π
It should never be invoked more than once, and that one time is just before application exit, because it deallocates static data that was allocated as "one-off" operations in SoQt::init(). So: once, at the end. That's the rule. π
NOTE: done() is not present in the original API for SGI's InventorXt library.
π SoQt::getTopLevelWidget
QWidget * SoQt::getTopLevelWidget (void) [static]
Returns the QWidget* that is the main widget for the application. And when this widget gets closed, SoQt::mainLoop() will return β unless the close event is caught by the user, in which case, plot twist, it won't. π
See also: getShellWidget()
πΈ SoQt::getShellWidget
QWidget * SoQt::getShellWidget (const QWidget * w) [static]
Returns a pointer to the Qt QWidget that is the top level widget for the given QWidget w. π«
Honestly this is just a convenience function so Open Inventor apps based on SoXt components are easier to port β because you can do the exact same thing by calling the QWidget::topLevelWidget() method directly on w. Convenience is convenience though. π
See also: getTopLevelWidget()
π SoQt::show
void SoQt::show (QWidget *const widget) [static]
Provided for easier porting / compatibility with the Open Inventor SoXt component classes. It'll call QWidget::show() and QWidget::raise() on the widget pointer you hand it. So it shows and raises. Overachiever behavior, we love to see it. β¨
See also: hide()
π SoQt::hide
void SoQt::hide (QWidget *const widget) [static]
Also for easier porting / compatibility with the Open Inventor SoXt component classes. It calls QWidget::hide() on the provided widget pointer. Just the one call. Simple. Elegant. π¦
See also: show()
π SoQt::setWidgetSize
void SoQt::setWidgetSize (QWidget *const w, const SbVec2s size) [static]
Here for easier porting of apps based on the Open Inventor SoXt component classes. It calls QWidget::resize() on the w widget pointer you pass in. Resize and slay. π
See also: getWidgetSize()
π§ SoQt::getWidgetSize
SbVec2s SoQt::getWidgetSize (const QWidget * w) [static]
Provided for easier porting / compatibility with the Open Inventor SoXt component classes. It does the same thing as calling QWidget::size() β except it returns an SbVec2s, which is the whole little twist of this function. π
See also: setWidgetSize()
π SoQt::createSimpleErrorDialog
void SoQt::createSimpleErrorDialog (QWidget * widget, const char * title, const char * string1, const char * string2 = NULL) [static]
A convenient way for the application programmer to throw up an obtrusive, application-global error dialog. Yes, obtrusive is the word. It's supposed to be. π₯
- If widget is
NULL, the dialog will be modal for the whole application β every single window gets blocked for input. All of them. - If widget isn't
NULL, only the window for that given widget will be blocked. Much more chill.
title is the title of the dialog box. string1 and string2 contain the text that will be shown in the dialog box. π
There will only be a single "OK" button for the user to press and then continue with the application. One button. No choices. iykyk. π«Ά
π SoQt::getVersionInfo
void SoQt::getVersionInfo (int * major = NULL, int * minor = NULL, int * micro = NULL) [static]
This method fills in the integers pointed to by the arguments with the corresponding part of the version release number of the SoQt library. So major gets the major, minor gets the minor, micro gets the micro. π―
A NULL pointer makes that part of the version number be ignored. Passing NULL is valid, it's just you saying "don't care." π
This method is not part of the original InventorXt API from SGI.
π SoQt::getVersionString
const char * SoQt::getVersionString (void) [static]
Returns a string containing the version id of the library. That's it, that's the function. β
This method is not part of the original InventorXt API from SGI.
π SoQt::getVersionToolkitString
const char * SoQt::getVersionToolkitString (void) [static]
Returns a string containing the version id of the Qt toolkit that the SoQt library is linked against. Slightly different fact than the one above, don't mix them up bestie. π§
This method is not part of the original InventorXt API from SGI.
π¨ SoQt::setFatalErrorHandler
SoQt::FatalErrorCB * SoQt::setFatalErrorHandler (SoQt::FatalErrorCB * cb, void * userdata) [static]
Sets up a callback to be invoked in the case of unexpected fatal error conditions within the SoQt library. Big responsibility, honestly. π
Almost any error condition inside the library is handled in a robust way through return values indicating errors for the offending calls β so the vast majority of the time you're fine. But there are a few cases that are impossible to handle without seriously crippling the functionality. π
(One example: if we fail to find any way of making a valid OpenGL canvas. That's an indication that something is seriously wrong on the end-user's system, and the SoQt library will not work properly.)
In the case of a fatal error, it is expected that the given application callback function communicates the problem to the end-user and then either exits the application or at least refrains from using any part of the SoQt library. Those are the options. π
If no callback is explicitly set up by the application, the SoQt library will display an error message to the end-user and then exit the application. So it handles it itself, dramatically. π
When setting a callback, this method returns a pointer to the previous callback function, or NULL if there was none. π
(This is an extension versus the original SGI InventorXt library API.)
On a related note β be aware that the end-user will still be notified about non-fatal errors and warning messages through a dialog box. So this callback doesn't silence those. If you want to handle those yourself, or if you don't want your end-user seeing any of these non-critical messages, you'll also need to install an error handler callback function on the Coin library itself:
SoDebugError::setHandlerCallback(myErrorHandlerCB, myCBUserData);
(Please also see the documentation of SoDebugError::setHandlerCallback().) πΈ
π¦ SoQt::isDebugLibrary
SbBool SoQt::isDebugLibrary (void) [static]
Returns TRUE if this binary version of the SoQt library was compiled with debug settings on. Debug girlies rise. π
This method was not part of the original SGI InventorXt library, but is an extension specific to the Coin project.
π SoQt::isCompatible
SbBool SoQt::isCompatible (unsigned int major, unsigned int minor) [static]
Returns TRUE if this version of the SoQt library has an Application Binary Interface compatible with the version you pass in as major and minor. Compatibility check, slay. β
This method was not part of the original SGI InventorXt library, but is an extension specific to the Coin project.
π SoQt::getABIType
SoQt::ABIType SoQt::getABIType (void) [static]
Returns an indication on how the library was compiled: as a dynamic library, or as a static library. Two vibes, one return value. π
This method was not part of the original SGI InventorXt library, but is an extension specific to the Coin project.
π SoQt::lockGL
void SoQt::lockGL (void) [static]
Locks other threads out of a code section until the caller thread invokes SoQt::unlockGL(). Threads stay in their lane. π§
It's meant to protect several threads invoking OpenGL calls in parallel, in case the underlying OpenGL implementation isn't multi-thread safe. Safety first, bestie. π‘οΈ
For convenience, the function can be invoked through the SOQT_ENTER_GL_SECTION().
This method is not part of the original InventorXt API from SGI.
π SoQt::unlockGL
void SoQt::unlockGL (void) [static]
See the documentation for SoQt::lockGL(). It's the other half of the pair β you lock, you do the thing, you unlock. π«
For convenience, the function can be invoked through the SOQT_LEAVE_GL_SECTION().
This method is not part of the original InventorXt API from SGI.
π AUTHOR π
Generated automatically by Doxygen for SoQt from the source code. (The robots wrote this part, not me. π€π )
That's the whole page, bestie β you made it to the end! π This was version 1.6.2, generated Sat Jan 6 2024 12:20:55. Go forth and initialize responsibly. π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 Β· BSD-3-Clause
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 Β· BSD-3-Clause
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 Β· BSD-3-Clause
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms