Lets assume your main function looks like this
int main( int argc, char ** argv)
{
RaveInitialize(true); // start openrave core
EnvironmentBasePtr penv = RaveCreateEnvironment(); // create the main environment
RaveSetDebugLevel(5);
penv->Load(scenefilename); // load the scene
ViewerBasePtr viewer = RaveCreateViewer(penv,viewername);
BOOST_ASSERT(!!viewer);
// attach it to the environment:
penv->Add(viewer);
bool showgui = true;
viewer->main(showgui);
penv->Destroy(); // destroy
}
int main( int argc, char ** argv)
{
RaveInitialize(true); // start openrave core
EnvironmentBasePtr penv = RaveCreateEnvironment(); // create the main environment
RaveSetDebugLevel(5);
penv->Load(scenefilename); // load the scene
ViewerBasePtr viewer = RaveCreateViewer(penv,viewername);
BOOST_ASSERT(!!viewer);
// attach it to the environment:
penv->Add(viewer);
bool showgui = true;
viewer->main(showgui);
penv->Destroy(); // destroy
}
To copy to clipboard, switch view to plain text mode
So what you need is a slot that can be called in a delayed fashion, i.e. once the event loop is runnning
class AppInitializer
: public QObject{
Q_OBJECT
public:
public Q_SLOTS:
void initialize();
};
class AppInitializer : public QObject
{
Q_OBJECT
public:
explicit AppInitializer( QObject *parent = 0 ) : QObject( parent ) {}
public Q_SLOTS:
void initialize();
};
To copy to clipboard, switch view to plain text mode
Inside initialize() you create your main window and show it.
In the main function you add this
// ....
penv->Add(viewer);
// create app initializer and schedule delayed initialization
AppInitializer appInit;
QMetaObject::invokeMethod( &appInit,
"initialize", Qt
::QueuedConnection );
bool showgui = true;
viewer->main(showgui);
// ....
// ....
penv->Add(viewer);
// create app initializer and schedule delayed initialization
AppInitializer appInit;
QMetaObject::invokeMethod( &appInit, "initialize", Qt::QueuedConnection );
bool showgui = true;
viewer->main(showgui);
// ....
To copy to clipboard, switch view to plain text mode
Cheers,
_
Bookmarks