Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mercury Open Inventor + Qt Designer soqtwidgetplugin

16 views
Skip to first unread message

marti...@gmail.com

unread,
Aug 19, 2008, 10:46:46 AM8/19/08
to
I'm using Mercury Open Inventor and Qt 4/Designer and could really use
a simple example of using the SoQtWidget plugin and the SoQtWrapper
class. Whatever I've tried, I haven't been able to change the default
contents ("Open Inventor by Mercury with Qt from Trolltech") of the
soqtwidgetplugin object. At best, what I'm trying to put in that
object just corrupts the main window...

(Programs that don't use the soqtwidgetplugin are fine.)

Thanks in advance!
Martin Beizer

marti...@gmail.com

unread,
Aug 19, 2008, 11:48:25 AM8/19/08
to
I got it! (At least it looks like it works.) I would welcome comments/
suggestions if there is a better way...

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Test2 w;

// Make a scene containing a red cone
SoSeparator *root = new SoSeparator;
SoPerspectiveCamera *myCamera = new SoPerspectiveCamera;
SoMaterial *myMaterial = new SoMaterial;
root->ref();
root->addChild(myCamera);
root->addChild(new SoDirectionalLight);
myMaterial->diffuseColor.setValue(1.0, 0.0, 0.0); // Red
root->addChild(myMaterial);
root->addChild(new SoCone);

SoQtRenderArea *viewer = w.ui.soqtwidgetplugin->getViewer();

// Make myCamera see everything.
myCamera->viewAll(root, viewer->getViewportRegion());

viewer->setSceneGraph(root);
viewer->setTitle("VisTool!");
w.ui.soqtwidgetplugin->show();

viewer->show();

w.show();
return a.exec();

0 new messages