当前位置: 首页>>代码示例>>C++>>正文


C++ Tab::setChild方法代码示例

本文整理汇总了C++中Tab::setChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Tab::setChild方法的具体用法?C++ Tab::setChild怎么用?C++ Tab::setChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tab的用法示例。


在下文中一共展示了Tab::setChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool TestJob::init()
{


   m_model->addStateListener(this);
   tinia::model::Viewer viewer;
   viewer.height = 500;
   viewer.width = 500;
   m_model->addElement("viewer", viewer);
   m_model->addElement<std::string>( "boundingbox", "-1.1 -1.1 -1.1 1.1 1.1 1.1" );
   m_model->addElement<int>( "renderlist", 0 );

   m_model->addElement<bool>("myTab", false);
   m_model->addAnnotation("myTab", "My tab");
      m_model->addElement<bool>("myBool", false);
   m_model->addElement<std::string>("myVal", "THIS WORKS!");

   const char* restrictions[] = {"select1", "select2", "select3", "select4"};
   m_model->addElementWithRestriction<std::string>("myVal2", "select3",
                                                       &restrictions[0], &restrictions[4]);

   m_model->addAnnotation("myVal2", "My special value");

   m_model->addConstrainedElement<int>("myIntBA", 5,0, 900);
   m_model->addConstrainedElement<double>("myDouble", 10., 0., 11.);
   m_model->addElement<bool>("myButton", false);

   m_model->addElement<bool>( "details", true, "Popup" );

   m_model->addAnnotation("myButton", "My pushButton");

   tinia::model::File file;
   m_model->addElement("SpecialFile", file);
   m_model->addAnnotation("SpecialFile", "Open file");
   m_model->addElement("SpecialFileName", file.name());

   using namespace tinia::model::gui;
   TabLayout* root = new TabLayout();
   HorizontalLayout *superLayout = new HorizontalLayout();

   Grid *mainGrid = new Grid(16, 1);
   //superLayout->addChild(mainGrid);
   Tab *mainTab = new Tab("myTab");
   mainTab->setChild(superLayout);
   root->addChild(mainTab);


   TabLayout *subTablayout = new TabLayout();
   Tab* subTab = new Tab("myBool");

   subTablayout->addChild(subTab);

   subTab->setChild(mainGrid);

   superLayout->addChild(subTablayout);

   // Simple Label-input-layout
   Grid *input1Grid = new Grid(4,3);
   mainGrid->setChild(0,0, input1Grid);
   input1Grid->setChild(0, 0, new Label("myVal"));
   input1Grid->setChild(0, 1, (new TextInput("myVal"))->setEnabledKey( "myTab", true ) );

   input1Grid->setChild(1,0, new Label("myVal2"));
   input1Grid->setChild(1,1, new ComboBox("myVal2"));

   input1Grid->setChild(2,0, new Label("myVal2"));
   input1Grid->setChild(2,1, new RadioButtons("myVal2"));

   PopupButton* popup = new PopupButton("details", false);
   input1Grid->setChild(2, 2, popup );
   popup->setEnabledKey( "myTab" );

   PopupButton* popup2 = new PopupButton( "myVal", true );
   input1Grid->setChild(3, 2, popup2 );

   popup2->setChild( new TextInput("myVal" ) );


   ElementGroup* popup_group = new ElementGroup( "myTab", true );
   popup->setChild( popup_group );
   popup_group->setChild( new RadioButtons( "myVal2" ) );


   mainGrid->setChild(1, 0, new SpinBox("myIntBA"));
   mainGrid->setChild(2, 0, new TextInput("myIntBA"));
   mainGrid->setChild(3, 0, new CheckBox("myTab"));
   mainGrid->setChild(4, 0, new CheckBox("myTab"));
   mainGrid->setChild(5, 0, new Button("myButton"));
   mainGrid->setChild(6, 0, new HorizontalSlider("myIntBA"));
   mainGrid->setChild(8,0, new DoubleSpinBox("myDouble"));
   mainGrid->setChild(9, 0, new CheckBox("myBool"));
   mainGrid->setChild(10, 0, new VerticalExpandingSpace());
   mainGrid->setChild(11, 0, new Label("myDouble", true ) );
   mainGrid->setChild(12, 0, new FileDialogButton("SpecialFile"));
   mainGrid->setChild(13, 0, new Label("SpecialFileName", true));

   ElementGroup* elemGroup = new ElementGroup("myTab", false);
   elemGroup->setVisibilityKey( "myTab" );

   elemGroup->setChild( new TextInput("myVal") );
//.........这里部分代码省略.........
开发者ID:asyr625,项目名称:tinia,代码行数:101,代码来源:TestJob.cpp

示例2: TabLayout

BOOST_FIXTURE_TEST_CASE(ExposedModelGUITestCase, ExposedModelFixture)
{
   model::Viewer viewer;
   viewer.height = 500;
   viewer.width = 500;
   model.addElement("viewer", viewer);
   model.addElement<bool>("myTab", false);
      model.addElement<bool>("myBool", false);
   model.addElement<std::string>("myVal", "THIS WORKS!");

   const char* restrictions[] = {"select1", "select2", "select3", "select4"};
   model.addElementWithRestriction<std::string>("myVal2", "select1",
                                                       &restrictions[0], &restrictions[4]);

   model.addConstrainedElement<int>("myIntBA", 5,0, 900);
   model.addConstrainedElement<double>("myDouble", 10., 0., 11.);
   model.addElement<bool>("myButton", false);


   using namespace model::gui;
   TabLayout* root = new TabLayout();
   HorizontalLayout *superLayout = new HorizontalLayout();

   Grid *mainGrid = new Grid(10, 1);
   superLayout->addChild(mainGrid);
   Tab *mainTab = new Tab("myTab");
   mainTab->setChild(superLayout);
   root->addChild(mainTab);

   // Used to hold our two input fields.


   // Simple Label-input-layout
   Grid *input1Grid = new Grid(3,2);
   mainGrid->setChild(0,0, input1Grid);
   input1Grid->setChild(0, 0, new Label("myVal"));
   input1Grid->setChild(0, 1, new TextInput("myVal"));

   input1Grid->setChild(1,0, new Label("myVal2"));
   input1Grid->setChild(1,1, new ComboBox("myVal2"));

   input1Grid->setChild(2,0, new Label("myVal2"));
   input1Grid->setChild(2,1, new RadioButtons("myVal2"));

   mainGrid->setChild(1, 0, new SpinBox("myIntBA"));
   mainGrid->setChild(2, 0, new TextInput("myIntBA"));
   mainGrid->setChild(3, 0, new CheckBox("myTab"));
   mainGrid->setChild(4, 0, new CheckBox("myTab"));
   mainGrid->setChild(5, 0, new Button("myButton"));
   mainGrid->setChild(6, 0, new HorizontalSlider("myIntBA"));
   mainGrid->setChild(8,0, new DoubleSpinBox("myDouble"));
   mainGrid->setChild(9, 0, new CheckBox("myBool"));

   ElementGroup* elemGroup = new ElementGroup("myTab", false);

   elemGroup->setChild(new TextInput("myVal"));
   mainGrid->setChild(7, 0, elemGroup);

   Grid* canvasGrid = new Grid(2,1);
   Canvas *canvas = new Canvas("viewer");

   canvasGrid->setChild(0,0, canvas);
   VerticalLayout* verticalLayout = new VerticalLayout;
   verticalLayout->setVisibilityKey( "myBool" );

   canvasGrid->setChild(1,0, verticalLayout);
   superLayout->addChild(canvasGrid);


   model.setGUILayout(root, DESKTOP);

   std::vector<model::StateSchemaElement> elements;
   model.getFullStateSchema(elements);
   
}
开发者ID:KjeFre,项目名称:tinia,代码行数:75,代码来源:ExposedModelTest.cpp


注:本文中的Tab::setChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。