本文整理汇总了C++中QTabWidget::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::show方法的具体用法?C++ QTabWidget::show怎么用?C++ QTabWidget::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVBoxLayout
void tst_QWidget_window::tst_recreateWindow_QTBUG40817()
{
QTabWidget tab;
QWidget *w = new QWidget;
tab.addTab(w, "Tab1");
QVBoxLayout *vl = new QVBoxLayout(w);
QLabel *lbl = new QLabel("HELLO1");
lbl->setObjectName("label1");
vl->addWidget(lbl);
w = new QWidget;
tab.addTab(w, "Tab2");
vl = new QVBoxLayout(w);
lbl = new QLabel("HELLO2");
lbl->setAttribute(Qt::WA_NativeWindow);
lbl->setObjectName("label2");
vl->addWidget(lbl);
tab.show();
QVERIFY(QTest::qWaitForWindowExposed(&tab));
QWindow *win = tab.windowHandle();
win->destroy();
QWindowPrivate *p = qt_window_private(win);
p->create(true);
win->show();
tab.setCurrentIndex(1);
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//#define ABC
#ifdef ABC
ParameterWidget *pw = new ParameterWidget();
pw->setProperties( "a", FloatParameterProperties() );
pw->setProperties( "b", FloatParameterProperties() );
pw->setProperties( "c", FloatParameterProperties() );
pw->setProperties( "d", FloatParameterProperties() );
pw->show();
#else
QTabWidget *tw = new QTabWidget();
QScrollArea *sa = new QScrollArea( );
sa->setWidgetResizable( true );
QWidget *w = new QWidget( );
w->setLayout( new QVBoxLayout() );
w->layout()->addWidget( new CoordinateSystemWidget( "a", FloatParameterProperties(), "b", FloatParameterProperties(), w ) );
( ( QVBoxLayout * ) w->layout() )->addStretch();
sa->setWidget( w );
tw->addTab( sa, "bla" );
tw->show();
app.processEvents();
w->layout()->addWidget( new CoordinateSystemWidget() );
#endif
return app.exec();
}
示例3: main
int main ( int argc, char **argv )
{
QApplication a( argc, argv );
QTabWidget tabWidget;
SliderTab *sliderTab = new SliderTab();
sliderTab->setAutoFillBackground( true );
sliderTab->setPalette( QColor( "DimGray" ) );
WheelTab *wheelTab = new WheelTab();
wheelTab->setAutoFillBackground( true );
wheelTab->setPalette( QColor( "Silver" ) );
KnobTab *knobTab = new KnobTab();
knobTab->setAutoFillBackground( true );
knobTab->setPalette( Qt::darkGray );
DialTab *dialTab = new DialTab();
dialTab->setAutoFillBackground( true );
dialTab->setPalette( Qt::darkGray );
tabWidget.addTab( new SliderTab, "Slider" );
tabWidget.addTab( new WheelTab, "Wheel/Thermo" );
tabWidget.addTab( knobTab, "Knob" );
tabWidget.addTab( dialTab, "Dial" );
tabWidget.resize( 800, 600 );
tabWidget.show();
return a.exec();
}
示例4: showsql
void menuconfigproject::showsql()
{
QTabWidget *win = new QTabWidget();
win->addTab(new sqldatatable(QString("groupname, groupparent, type"), "project_" + this->name + "_groupe", 3), "groupe");
win->addTab(new sqldatatable(QString("lastname, firstname, email, groupid, refbool, questionbool"), "project_" + this->name + "_project", 6), "personne");
win->addTab(new sqldatatable(QString("question, groupid, type, note, sujet, qgroupid, typef, ref_only, splitchar"), "project_" + this->name + "_question", 9), "question");
win->setWindowModality(Qt::ApplicationModal);
win->show();
}
示例5: main
int main (int argc, char **argv)
{
QApplication a(argc, argv);
QTabWidget tabWidget;
tabWidget.addTab(new CompassGrid, "Compass");
tabWidget.addTab(new CockpitGrid, "Cockpit");
tabWidget.show();
return a.exec();
}
示例6: main
int main(int argc,char **argv) {
QApplication app(argc,argv);
QLabel *label_first = new QLabel("first");
QLabel *label_second = new QLabel("second");
QTabWidget w;
w.addTab(label_first,"first");
w.addTab(label_second,"second");
w.setWindowTitle("test for QTabWidget");
w.show();
return app.exec();
}
示例7: main
int main ( int argc, char **argv )
{
QApplication a( argc, argv );
QTabWidget w;
w.addTab( new PlotTab( false, &w ), "Non Parametric" );
w.addTab( new PlotTab( true, &w ), "Parametric" );
const QSize sz = 0.6 * QApplication::desktop()->size();
w.resize( sz.boundedTo( QSize( 800, 600 ) ) );
w.show();
return a.exec();
}
示例8: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w1;
Widget w2;
QTabWidget tabWidget;
tabWidget.setTabPosition(QTabWidget::South);
tabWidget.addTab(&w1, "Instance 1");
tabWidget.addTab(&w2, "Instance 2");
tabWidget.show();
return a.exec();
}
示例9: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTabWidget *tab = new QTabWidget;
QTextEdit *edit = new QTextEdit;
Widget *w = new Widget;
tab->addTab(w, "edit");
tab->addTab(edit, "recv");
QObject::connect(w, SIGNAL(message(QString)), edit, SLOT(append(QString)));
edit->append("plain text");
tab->show();
// Widget w;
// w.show();
return a.exec();
}
示例10: main
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QTabWidget tab;
Scribble scribble(&tab, "scribble");
TabletStats tabStats( &tab, "tablet stats" );
scribble.setMinimumSize( 500, 350 );
tabStats.setMinimumSize( 500, 350 );
tab.addTab(&scribble, "Scribble" );
tab.addTab(&tabStats, "Tablet Stats" );
a.setMainWidget( &tab );
if ( QApplication::desktop()->width() > 550
&& QApplication::desktop()->height() > 366 )
tab.show();
else
tab.showMaximized();
return a.exec();
}
示例11: dynamicNormalizerGuiMain
static int dynamicNormalizerGuiMain(int argc, char* argv[])
{
uint32_t versionMajor, versionMinor, versionPatch;
MDynamicAudioNormalizer::getVersionInfo(versionMajor, versionMinor, versionPatch);
//initialize application
QApplication app(argc, argv);
app.setWindowIcon(QIcon(":/res/chart_curve.png"));
app.setStyle(new QPlastiqueStyle());
//create basic tab widget
QTabWidget window;
window.setWindowTitle(QString("Dynamic Audio Normalizer - Log Viewer [%1]").arg(QString().sprintf("v%u.%02u-%u", versionMajor, versionMinor, versionPatch)));
window.setMinimumSize(640, 480);
window.show();
//get arguments
const QStringList args = app.arguments();
//choose input file
const QString logFileName = (args.size() < 2) ? QFileDialog::getOpenFileName(&window, "Open Log File", QString(), QString("Log File (*.log)")) : args.at(1);
if(logFileName.isEmpty())
{
return EXIT_FAILURE;
}
//check for existence
if(!(QFileInfo(logFileName).exists() && QFileInfo(logFileName).isFile()))
{
QMessageBox::critical(&window, QString().sprintf("Dynamic Audio Normalizer"), QString("Error: The specified log file could not be found!"));
return EXIT_FAILURE;
}
//open the input file
QFile logFile(logFileName);
if(!logFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
QMessageBox::critical(&window, QString().sprintf("Dynamic Audio Normalizer"), QString("Error: The selected log file could not opened for reading!"));
return EXIT_FAILURE;
}
//wrap into text stream
QTextStream textStream(&logFile);
textStream.setCodec("UTF-8");
double minValue = DBL_MAX;
double maxValue = 0.0;
unsigned int channels = 0;
//parse header
if(!parseHeader(textStream, channels))
{
QMessageBox::critical(&window, QString("Dynamic Audio Normalizer"), QString("Error: Failed to parse the header of the log file!\nProbably the file is of an unsupported type."));
return EXIT_FAILURE;
}
//allocate buffers
LogFileData *data = new LogFileData[channels];
QCustomPlot *plot = new QCustomPlot[channels];
//load data
parseData(textStream, channels, data, minValue, maxValue);
logFile.close();
//check data
if((data[0].original.size() < 1) || (data[0].minimal.size() < 1) || (data[0].smoothed.size() < 1))
{
QMessageBox::critical(&window, QString("Dynamic Audio Normalizer"), QString("Error: Failed to load data. Log file countains no valid data!"));
delete [] data;
delete [] plot;
return EXIT_FAILURE;
}
//determine length of data
unsigned int length = UINT_MAX;
for(unsigned int c = 0; c < channels; c++)
{
length = qMin(length, (unsigned int) data[c].original.count());
length = qMin(length, (unsigned int) data[c].minimal .count());
length = qMin(length, (unsigned int) data[c].smoothed.count());
}
//create x-axis steps
QVector<double> steps(length);
for(unsigned int i = 0; i < length; i++)
{
steps[i] = double(i);
}
//now create the plots
for(unsigned int c = 0; c < channels; c++)
{
//init the legend
plot[c].legend->setVisible(true);
plot[c].legend->setFont(QFont("Helvetica", 9));
//create graph and assign data to it:
createGraph(&plot[c], steps, data[c].original, Qt::blue, Qt::SolidLine, 1);
createGraph(&plot[c], steps, data[c].minimal, Qt::green, Qt::SolidLine, 1);
createGraph(&plot[c], steps, data[c].smoothed, Qt::red, Qt::DashLine, 2);
//.........这里部分代码省略.........
示例12: main
//.........这里部分代码省略.........
// PID Master GUI
std::string masterPIDName = masterName + " PID";
mtsPIDQtWidget * pidMasterGUI = new mtsPIDQtWidget(masterPIDName, 8);
pidMasterGUI->Configure();
componentManager->AddComponent(pidMasterGUI);
componentManager->Connect(pidMasterGUI->GetName(), "Controller", mtm->PIDComponentName(), "Controller");
tabWidget->addTab(pidMasterGUI, masterPIDName.c_str());
// PID Slave GUI
std::string slavePIDName = slaveName + " PID";
mtsPIDQtWidget * pidSlaveGUI = new mtsPIDQtWidget(slavePIDName, 7);
pidSlaveGUI->Configure();
componentManager->AddComponent(pidSlaveGUI);
componentManager->Connect(pidSlaveGUI->GetName(), "Controller", psm->PIDComponentName(), "Controller");
tabWidget->addTab(pidSlaveGUI, slavePIDName.c_str());
// Master GUI
mtsIntuitiveResearchKitArmQtWidget * masterGUI = new mtsIntuitiveResearchKitArmQtWidget(mtm->Name() + "GUI");
masterGUI->Configure();
componentManager->AddComponent(masterGUI);
tabWidget->addTab(masterGUI, mtm->Name().c_str());
// connect masterGUI to master
componentManager->Connect(masterGUI->GetName(), "Manipulator", mtm->Name(), "Robot");
// Slave GUI
mtsIntuitiveResearchKitArmQtWidget * slaveGUI = new mtsIntuitiveResearchKitArmQtWidget(psm->Name() + "GUI");
slaveGUI->Configure();
componentManager->AddComponent(slaveGUI);
tabWidget->addTab(slaveGUI, psm->Name().c_str());
// connect slaveGUI to slave
componentManager->Connect(slaveGUI->GetName(), "Manipulator", psm->Name(), "Robot");
// Teleoperation
std::string teleName = masterName + "-" + slaveName;
mtsTeleOperationQtWidget * teleGUI = new mtsTeleOperationQtWidget(teleName + "GUI");
teleGUI->Configure();
componentManager->AddComponent(teleGUI);
tabWidget->addTab(teleGUI, teleName.c_str());
mtsTeleOperation * tele = new mtsTeleOperation(teleName, periodTeleop);
// Default orientation between master and slave
vctMatRot3 master2slave;
master2slave.From(vctAxAnRot3(vct3(0.0, 0.0, 1.0), 180.0 * cmnPI_180));
tele->SetRegistrationRotation(master2slave);
componentManager->AddComponent(tele);
// connect teleGUI to tele
componentManager->Connect(teleGUI->GetName(), "TeleOperation", tele->GetName(), "Setting");
componentManager->Connect(tele->GetName(), "Master", mtm->Name(), "Robot");
componentManager->Connect(tele->GetName(), "Slave", psm->Name(), "Robot");
componentManager->Connect(tele->GetName(), "Clutch", "io", "CLUTCH");
componentManager->Connect(tele->GetName(), "OperatorPresent", operatorPresentComponent, operatorPresentInterface);
console->AddTeleOperation(tele->GetName());
}
// configure data collection if needed
if (options.IsSet("collection-config")) {
// make sure the json config file exists
fileExists("JSON data collection configuration", jsonCollectionConfigFile);
mtsCollectorFactory * collectorFactory = new mtsCollectorFactory("collectors");
collectorFactory->Configure(jsonCollectionConfigFile);
componentManager->AddComponent(collectorFactory);
collectorFactory->Connect();
mtsCollectorQtWidget * collectorQtWidget = new mtsCollectorQtWidget();
tabWidget->addTab(collectorQtWidget, "Collection");
mtsCollectorQtFactory * collectorQtFactory = new mtsCollectorQtFactory("collectorsQt");
collectorQtFactory->SetFactory("collectors");
componentManager->AddComponent(collectorQtFactory);
collectorQtFactory->Connect();
collectorQtFactory->ConnectToWidget(collectorQtWidget);
}
// show all widgets
tabWidget->show();
//-------------- create the components ------------------
io->CreateAndWait(2.0 * cmn_s); // this will also create the pids as they are in same thread
io->StartAndWait(2.0 * cmn_s);
// start all other components
componentManager->CreateAllAndWait(2.0 * cmn_s);
componentManager->StartAllAndWait(2.0 * cmn_s);
// QtApplication will run in main thread and return control
// when exited.
componentManager->KillAllAndWait(2.0 * cmn_s);
componentManager->Cleanup();
// delete dvgc robot
delete io;
delete robotWidgetFactory;
// stop all logs
cmnLogger::Kill();
return 0;
}
示例13: main
//.........这里部分代码省略.........
// IO
mtsRobotIO1394 * io = new mtsRobotIO1394("io", ioPeriod, firewirePort);
io->Configure(config_io);
componentManager->AddComponent(io);
// connect ioGUIMaster to io
mtsRobotIO1394QtWidgetFactory * robotWidgetFactory = new mtsRobotIO1394QtWidgetFactory("robotWidgetFactory");
componentManager->AddComponent(robotWidgetFactory);
componentManager->Connect("robotWidgetFactory", "RobotConfiguration", "io", "Configuration");
robotWidgetFactory->Configure();
// mtsPID
mtsPID* pid = new mtsPID("pid", ioPeriod); // periodicity will be ignore because ExecIn/Out are connected
pid->Configure(config_pid);
componentManager->AddComponent(pid);
componentManager->Connect(pid->GetName(), "RobotJointTorqueInterface", "io", config_name);
componentManager->Connect(pid->GetName(), "ExecIn", "io", "ExecOut");
// PID GUI
mtsPIDQtWidget * pidMasterGUI = new mtsPIDQtWidget("pid master", 7);
pidMasterGUI->Configure();
componentManager->AddComponent(pidMasterGUI);
componentManager->Connect(pidMasterGUI->GetName(), "Controller", pid->GetName(), "Controller");
// psm
mtsIntuitiveResearchKitPSM * psm = new mtsIntuitiveResearchKitPSM(config_name, armPeriod);
psm->Configure(config_kinematics);
componentManager->AddComponent(psm);
componentManager->Connect(psm->GetName(), "PID", pid->GetName(), "Controller");
componentManager->Connect(psm->GetName(), "RobotIO", "io", config_name);
componentManager->Connect(psm->GetName(), "Adapter", "io", psm->GetName() + "-Adapter");
componentManager->Connect(psm->GetName(), "Tool", "io", psm->GetName() + "-Tool");
componentManager->Connect(psm->GetName(), "ManipClutch", "io", psm->GetName() + "-ManipClutch");
// psm GUI
mtsIntuitiveResearchKitArmQtWidget * psmGUI = new mtsIntuitiveResearchKitArmQtWidget(config_name + "GUI");
componentManager->AddComponent(psmGUI);
componentManager->Connect(psmGUI->GetName(), "Manipulator", psm->GetName(), "Robot");
ROS_INFO("\n Name is :%s \n :%s \n :%s \n :%s \n ",config_name.c_str(),config_pid.c_str(),config_io.c_str()
,config_kinematics.c_str());
// ros wrapper
mtsROSBridge robotBridge("RobotBridge", rosPeriod, true);
// populate interfaces
const dvrk_topics_version::version version = dvrk_topics_version::v1_3_0;
dvrk::add_topics_psm(robotBridge, "/dvrk/" + config_name, psm->GetName(), version);
if (options.IsSet("io-ros")) {
dvrk::add_topics_io(robotBridge, "/dvrk/" + config_name + "/io", psm->GetName(), version);
}
// add component and connect
componentManager->AddComponent(&robotBridge);
dvrk::connect_bridge_psm(robotBridge, psm->GetName());
if (options.IsSet("io-ros")) {
dvrk::connect_bridge_io(robotBridge, io->GetName(), psm->GetName());
}
// organize all widgets in a tab widget
QTabWidget * tabWidget = new QTabWidget;
// io gui
mtsRobotIO1394QtWidgetFactory::WidgetListType::const_iterator iterator;
for (iterator = robotWidgetFactory->Widgets().begin();
iterator != robotWidgetFactory->Widgets().end();
++iterator) {
tabWidget->addTab(*iterator, (*iterator)->GetName().c_str());
}
// pid gui
tabWidget->addTab(pidMasterGUI, (config_name + " PID").c_str());
// psm gui
tabWidget->addTab(psmGUI, psm->GetName().c_str());
// button gui
tabWidget->addTab(robotWidgetFactory->ButtonsWidget(), "Buttons");
// show widget
tabWidget->show();
//-------------- create the components ------------------
io->CreateAndWait(2.0 * cmn_s); // this will also create the pids as they are in same thread
io->StartAndWait(2.0 * cmn_s);
pid->StartAndWait(2.0 * cmn_s);
// start all other components
componentManager->CreateAllAndWait(2.0 * cmn_s);
componentManager->StartAllAndWait(2.0 * cmn_s);
// QtApp is now running
componentManager->KillAllAndWait(2.0 * cmn_s);
componentManager->Cleanup();
// delete dvgc robot
delete pid;
delete pidMasterGUI;
delete psm;
delete psmGUI;
// stop all logs
cmnLogger::Kill();
}
示例14: main
//.........这里部分代码省略.........
console->Connect();
// psm GUI
mtsIntuitiveResearchKitArmQtWidget* psmGUI = new mtsIntuitiveResearchKitArmQtWidget(config_name+"GUI");
psmGUI->Configure();
componentManager->AddComponent(psmGUI);
componentManager->Connect(psmGUI->GetName(), "Manipulator", psm->Name(), "Robot");
//-------------------------------------------------------
// Start ROS Bridge
// ------------------------------------------------------
ROS_INFO("\n Name is :%s \n :%s \n :%s \n :%s \n ",config_name.c_str(),config_pid.c_str(),config_io.c_str()
,config_kinematics.c_str());
// ros wrapper
mtsROSBridge robotBridge("RobotBridge", 20 * cmn_ms, true);
// connect to psm
robotBridge.AddPublisherFromReadCommand<prmPositionCartesianGet, geometry_msgs::Pose>(
config_name, "GetPositionCartesian", "/dvrk_psm/cartesian_pose_current");
robotBridge.AddPublisherFromReadCommand<vctDoubleVec, cisst_msgs::vctDoubleVec>(
pid->GetName(), "GetEffortJointDesired", "/dvrk_psm/joint_effort_current");
robotBridge.AddPublisherFromReadCommand<prmPositionJointGet, sensor_msgs::JointState>(
pid->GetName(), "GetPositionJoint", "/dvrk_psm/joint_position_current");
robotBridge.AddPublisherFromEventWrite<prmEventButton, std_msgs::Bool>(
"ManipClutch","Button","/dvrk_psm/manip_clutch_state");
robotBridge.AddPublisherFromReadCommand<std::string, std_msgs::String>(
config_name,"GetRobotControlState","/dvrk_psm/robot_state_current");
// Finally Working Form; However it is still unsafe since there is no safety check.
// Use with caution and with your hand on the E-Stop.
robotBridge.AddSubscriberToWriteCommand<prmForceTorqueJointSet , sensor_msgs::JointState>(
pid->GetName(), "SetTorqueJoint", "/dvrk_psm/set_joint_effort");
robotBridge.AddSubscriberToWriteCommand<std::string, std_msgs::String>(
config_name, "SetRobotControlState", "/dvrk_psm/set_robot_state");
robotBridge.AddSubscriberToWriteCommand<bool, std_msgs::Bool>(
pid->GetName(),"Enable","/dvrk_psm/enable_pid");
robotBridge.AddSubscriberToWriteCommand<prmPositionJointSet, sensor_msgs::JointState>(
pid->GetName(),"SetPositionJoint","/dvrk_psm/set_position_joint");
robotBridge.AddSubscriberToWriteCommand<prmPositionCartesianSet, geometry_msgs::Pose>(
config_name, "SetPositionCartesian", "/dvrk_psm/set_position_cartesian");
componentManager->AddComponent(&robotBridge);
componentManager->Connect(robotBridge.GetName(), config_name, psm->Name(), "Robot");
componentManager->Connect(robotBridge.GetName(), pid->GetName(), pid->GetName(),"Controller");
componentManager->Connect(robotBridge.GetName(), "ManipClutch", "io", config_name + "-ManipClutch");
// componentManager->Connect(robotBridge.GetName(), "Clutch", "io", "CLUTCH");
//-------------------------------------------------------
// End ROS Bridge
// ------------------------------------------------------
// organize all widgets in a tab widget
QTabWidget * tabWidget = new QTabWidget;
// io gui
mtsRobotIO1394QtWidgetFactory::WidgetListType::const_iterator iterator;
for (iterator = robotWidgetFactory->Widgets().begin();
iterator != robotWidgetFactory->Widgets().end();
++iterator)
{
tabWidget->addTab(*iterator, (*iterator)->GetName().c_str());
}
tabWidget->addTab(consoleGUI, "Main");
// pid gui
tabWidget->addTab(pidMasterGUI, (config_name + "PID").c_str());
// psm gui
tabWidget->addTab(psmGUI, psm->Name().c_str());
// button gui
tabWidget->addTab(robotWidgetFactory->ButtonsWidget(), "Buttons");
// show widget
tabWidget->show();
//-------------- create the components ------------------
io->CreateAndWait(2.0 * cmn_s); // this will also create the pids as they are in same thread
io->StartAndWait(2.0 * cmn_s);
pid->StartAndWait(2.0 * cmn_s);
// start all other components
componentManager->CreateAllAndWait(2.0 * cmn_s);
componentManager->StartAllAndWait(2.0 * cmn_s);
// QtApp will run here
componentManager->KillAllAndWait(2.0 * cmn_s);
componentManager->Cleanup();
// delete dvgc robot
delete pid;
delete pidMasterGUI;
delete psm;
delete psmGUI;
delete robotWidgetFactory;
// stop all logs
cmnLogger::Kill();
}
示例15: main
//.........这里部分代码省略.........
componentManager->AddComponent(pidMasterGUI);
componentManager->Connect(pidMasterGUI->GetName(), "Controller", mtm->PIDComponentName(), "Controller");
mtsPIDQtWidget * pidMasterGUI2 = new mtsPIDQtWidget("PID MTML", 8);
pidMasterGUI2->Configure();
componentManager->AddComponent(pidMasterGUI2);
componentManager->Connect(pidMasterGUI2->GetName(), "Controller", mtml->PIDComponentName(), "Controller");
// PID Slave GUI
mtsPIDQtWidget * pidSlaveGUI = new mtsPIDQtWidget("PID Slave", 7);
pidSlaveGUI->Configure();
componentManager->AddComponent(pidSlaveGUI);
componentManager->Connect(pidSlaveGUI->GetName(), "Controller", psm->PIDComponentName(), "Controller");
mtsPIDQtWidget * pidSlaveGUI2 = new mtsPIDQtWidget("PID PSM2", 7);
pidSlaveGUI2->Configure();
componentManager->AddComponent(pidSlaveGUI2);
componentManager->Connect(pidSlaveGUI2->GetName(), "Controller", psm2->PIDComponentName(), "Controller");
// Teleoperation
mtsTeleOperationQtWidget * teleGUI = new mtsTeleOperationQtWidget("teleGUI");
teleGUI->Configure();
componentManager->AddComponent(teleGUI);
mtsTeleOperation * tele = new mtsTeleOperation("tele", 5.0 * cmn_ms);
componentManager->AddComponent(tele);
// connect teleGUI to tele
componentManager->Connect("teleGUI", "TeleOperation", "tele", "Setting");
mtsTeleOperationQtWidget * teleGUI2 = new mtsTeleOperationQtWidget("teleGUI2");
teleGUI2->Configure();
componentManager->AddComponent(teleGUI2);
mtsTeleOperation * tele2 = new mtsTeleOperation("tele2", 5.0 * cmn_ms);
componentManager->AddComponent(tele2);
// connect teleGUI to tele
componentManager->Connect("teleGUI2", "TeleOperation", "tele2", "Setting");
// TextToSpeech
mtsTextToSpeech* textToSpeech = new mtsTextToSpeech;
textToSpeech->AddInterfaceRequiredForEventString("ErrorMsg", "RobotErrorMsg");
componentManager->AddComponent(textToSpeech);
componentManager->Connect(textToSpeech->GetName(), "ErrorMsg", psm->Name(), "Robot");
// connect teleop to Master + Slave + Clutch
componentManager->Connect("tele", "Master", mtm->Name(), "Robot");
componentManager->Connect("tele", "Slave", psm->Name(), "Robot");
componentManager->Connect("tele", "CLUTCH", "io", "CLUTCH");
componentManager->Connect("tele", "COAG", "io", "COAG");
componentManager->Connect("tele2", "Master", mtml->Name(), "Robot");
componentManager->Connect("tele2", "Slave", psm2->Name(), "Robot");
componentManager->Connect("tele2", "CLUTCH", "io", "CLUTCH");
componentManager->Connect("tele2", "COAG", "io", "COAG");
// organize all widgets in a tab widget
QTabWidget * tabWidget = new QTabWidget;
tabWidget->addTab(consoleGUI, "Main");
tabWidget->addTab(teleGUI, "Tele-op");
tabWidget->addTab(teleGUI2, "Tele-op2");
tabWidget->addTab(pidMasterGUI, "PID Master");
tabWidget->addTab(pidMasterGUI2, "PID MTML");
tabWidget->addTab(pidSlaveGUI, "PID Slave");
tabWidget->addTab(pidSlaveGUI2, "PID PSM2");
mtsRobotIO1394QtWidgetFactory::WidgetListType::const_iterator iterator;
for (iterator = robotWidgetFactory->Widgets().begin();
iterator != robotWidgetFactory->Widgets().end();
++iterator) {
tabWidget->addTab(*iterator, (*iterator)->GetName().c_str());
}
tabWidget->addTab(robotWidgetFactory->ButtonsWidget(), "Buttons");
tabWidget->show();
//-------------- create the components ------------------
io->CreateAndWait(2.0 * cmn_s); // this will also create the pids as they are in same thread
// start all other components
componentManager->CreateAllAndWait(2.0 * cmn_s);
componentManager->StartAllAndWait(2.0 * cmn_s);
// QtApplication will run in main thread and return control
// when exited.
qtAppTask.exec();
componentManager->KillAllAndWait(2.0 * cmn_s);
componentManager->Cleanup();
// delete dvgc robot
delete tele;
delete tele2;
delete pidMasterGUI;
delete pidMasterGUI2;
delete pidSlaveGUI;
delete pidSlaveGUI2;
delete io;
delete robotWidgetFactory;
// stop all logs
cmnLogger::Kill();
return 0;
}