In my attempts last week to render a Coin3d scene in a Qt application, I used Qt's hellogl demo program as a template and modified it. The Coin scene renders nicely now, but I cannot get it to recognize Qt's signals & slots. My window.cpp file still contains this:
connect(xSlider, SIGNAL(valueChanged(int)), coinWidget, SLOT(setXRotation(int)));
connect(coinWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
connect(xSlider, SIGNAL(valueChanged(int)), coinWidget, SLOT(setXRotation(int)));
connect(coinWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
To copy to clipboard, switch view to plain text mode
My CoinWidget constructor looks like this:
{
SoQt::init(this);
SoSeparator *root = new SoSeparator;
SoRotationXYZ *rootRot = new SoRotationXYZ;
root->ref();
root->addChild(rootRot);
root->addChild(new SoCone);
rootRot->angle=xRot;
SoQtExaminerViewer *eviewer = new SoQtExaminerViewer(this);
eviewer->setDecoration(false);
eviewer->setSceneGraph(root);
eviewer->show();
}
CoinWidget::CoinWidget(QWidget *parent) : QMainWindow(parent)
{
SoQt::init(this);
SoSeparator *root = new SoSeparator;
SoRotationXYZ *rootRot = new SoRotationXYZ;
root->ref();
root->addChild(rootRot);
root->addChild(new SoCone);
rootRot->angle=xRot;
SoQtExaminerViewer *eviewer = new SoQtExaminerViewer(this);
eviewer->setDecoration(false);
eviewer->setSceneGraph(root);
eviewer->show();
}
To copy to clipboard, switch view to plain text mode
...such that the xRot variable *should* be modified by moving the slider (and thus cause my model to rotate), but it's not happening. I'm thinking that when using SoQt, there may be an additional step involved. Any suggestions?
Bookmarks