Hi all,
We are trying to do two diffrent frames. one for OSG and another for menue.
Ofcourse the menue have to handle the scene.

We tryed to create new class MyWidget that inheret from QWidget and in the
constractor we load the scene into SimpleViewerQT, and add a buttun and put
them both in a grid, and it shows us just the butten.
what we did wrong?
here is our code,
(its append into the osgsimpleviewerQT3.cpp file(witout the main)

class MyWidget: public QWidget

{

public
:

MyWidget( QWidget *parent=0, const char *name=0 );

};



MyWidget::MyWidget( QWidget *parent, const char *name
)

:
QWidget( parent, name )

{

QPushButton *quit = new QPushButton( "Quit", this, "quit" );

quit->setFont( QFont( "Times", 18, QFont::Bold ) );

connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );

osg::ref_ptr<osg::Node> loadedModel =
osgDB::readNodeFile("/home/natalie/project/T72-tank/t72-tank_des.flt");

if(loadedModel==NULL)

{

std::cout<<"error, problem with load"<<endl;

}

SimpleViewerQT* viewerWindow = new SimpleViewerQT;

viewerWindow->setSceneData(loadedModel.get());

viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);

QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );

//2
x2, 10 pixel border

grid->addWidget( quit, 0, 0 );

grid->addWidget( viewerWindow, 1, 1 );

grid->setColStretch( 1, 10 );

}



int main( int argc, char **argv
)

{

QApplication a( argc, argv );



MyWidget w;

w.setGeometry( 100, 100, 640, 400 );

a.setMainWidget( &w );

w.show();

return a.exec();

}
_______________________________________________
arch mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/arch

Reply via email to