01 // SoQt header files 02 #include 03 #include 04 05 // Coin header files 06 #include 07 #include 08 #include 09 10 int main(int argc, char **argv) 11 { 12 // Initialize SoQt library. 13 // The return value points to a Qt window 14 QWidget *window = SoQt::init("test"); 15 16 // Create a "scene graph" 17 SoSeparator *root = new SoSeparator; 18 root->ref(); 19 20 // Set the RGB color. Yellow in this case 21 SoBaseColor *color = new SoBaseColor; 22 color->rgb = SbColor(1, 1, 0); 23 root->addChild(color); 24 25 // Create a text 26 SoText3 *text3D = new SoText3(); 27 text3D->string.setValue("Hello SoQt"); 28 root->addChild(text3D); 29 30 // Create a viewer 31 SoQtExaminerViewer *b = new SoQtExaminerViewer(window); 32 b->setSceneGraph(root); 33 b->show(); 34 35 // Start the window 36 SoQt::show(window); 37 // Loop until exit. 38 SoQt::mainLoop(); 39 40 // Delete viewer and reference for scene 41 delete b; 42 root->unref(); 43 44 return 0; 45 }