Posted wrong code. Sorry.
My main stuff:
int main(int argc, char *argv[])
{
QWidget *mainwin
= SoQt
::init(argc, argv, argv
[0]);
if (mainwin==0)
exit(1);
HBWindow*window=new HBWindow(mainwin,"HBWindow");
JEWindow*jew = new JointEditorWindow(0, "JEWindow");
jew->showMaximized();
window->showMaximized();
//SoQt::show(mainwin);
SoQt::mainLoop();
return 0;
}
int main(int argc, char *argv[])
{
QWidget *mainwin = SoQt::init(argc, argv, argv[0]);
if (mainwin==0)
exit(1);
HBWindow*window=new HBWindow(mainwin,"HBWindow");
JEWindow*jew = new JointEditorWindow(0, "JEWindow");
jew->showMaximized();
window->showMaximized();
//SoQt::show(mainwin);
SoQt::mainLoop();
return 0;
}
To copy to clipboard, switch view to plain text mode
Then the HBWindow as well as the JEWindow are basically the same. The both are inherited from QMainWindow and create a layout and add some attributs etc. to it. JEWindow looks exactly the same. _viewer is globally defined to be a class of SkelDisplay(...)
HBalanceWindow::HBalanceWindow
(
)
{
// Creates the layout for the main window
_viewer = new SkelDisplay(main_window_layout, this);
_attributs = new AttributsWidget(main_window_layout, this);
layout->addWidget(_viewer);
layout->addWidget(_attributs);
setCentralWidget(main_window_layout);
main_window_layout->setLayout(layout);
}
HBalanceWindow::HBalanceWindow
(
QWidget *parent, const char *name
)
: QMainWindow(parent,name)
{
// Creates the layout for the main window
QWidget *main_window_layout = new QWidget;
QHBoxLayout *layout = new QHBoxLayout;
_viewer = new SkelDisplay(main_window_layout, this);
_attributs = new AttributsWidget(main_window_layout, this);
layout->addWidget(_viewer);
layout->addWidget(_attributs);
setCentralWidget(main_window_layout);
main_window_layout->setLayout(layout);
}
To copy to clipboard, switch view to plain text mode
The more interesting part is probably inside the SkelDisplay(...) method. Here I create the SoQT Viewer as well as the callbacks. The callbacks are defined as static methods. There is no QtThread.
SkelDisplay::SkelDisplay
(
)
:
{
// Create the render view
//
_ivviewer = new SoQtExaminerViewer(this);
_ivviewer->setBackgroundColor(SbColor(0., 0., 0.));
_iv_root = new SoSeparator;
_iv_root->ref();
//Add some stuff to the _iv_root
...
_iv_root->addChild(complexity);
// Adds an event callback to catch mouse button hits
//
SoEventCallback *event_CB = new SoEventCallback;
_iv_root->addChild(event_CB);
// Set up the event callback. We want to pass the object itself
// as the callback func must be declared static
event_CB->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
mouse_pressed_CB,
this);
_ivviewer->setSceneGraph(_iv_root);
.....
}
SkelDisplay::SkelDisplay
(
QWidget *parent,
QWidget *main_win
)
:
QWidget(parent)
{
// Create the render view
//
_ivviewer = new SoQtExaminerViewer(this);
_ivviewer->setBackgroundColor(SbColor(0., 0., 0.));
_iv_root = new SoSeparator;
_iv_root->ref();
//Add some stuff to the _iv_root
...
_iv_root->addChild(complexity);
// Adds an event callback to catch mouse button hits
//
SoEventCallback *event_CB = new SoEventCallback;
_iv_root->addChild(event_CB);
// Set up the event callback. We want to pass the object itself
// as the callback func must be declared static
event_CB->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
mouse_pressed_CB,
this);
_ivviewer->setSceneGraph(_iv_root);
.....
}
To copy to clipboard, switch view to plain text mode
I put some printf(...) statements so check if there is no confusion between the methods call. This seems to work. But at the end the update of the right window fails.
Thanks.
Bookmarks