コード例 #1
0
ファイル: main.cpp プロジェクト: gregorburger/libQGLViewer
int main(int argc, char** argv)
{
  QApplication application(argc,argv);

  // Instantiate the two viewers.
  StandardCamera* sc = new StandardCamera();
  Viewer viewer(sc);
  CameraViewer cviewer(sc);

  // Make sure every v camera movement updates the camera viewer
  QObject::connect(viewer.camera()->frame(), SIGNAL(manipulated()), &cviewer, SLOT(updateGL()));
  QObject::connect(viewer.camera()->frame(), SIGNAL(spun()), &cviewer, SLOT(updateGL()));
  // Also update on camera change (type or mode)
  QObject::connect(&viewer, SIGNAL(cameraChanged()), &cviewer, SLOT(updateGL()));

#if QT_VERSION < 0x040000
  application.setMainWidget(&viewer);
#else
  viewer.setWindowTitle("standardCamera");
  cviewer.setWindowTitle("Camera viewer");
#endif

  cviewer.show();
  viewer.show();

  return application.exec();
}
コード例 #2
0
void ConsoleMaster::createNewWindow()
{
  ConsoleWindow* win = new ConsoleWindow(&db_);
  windows_.append(win);

  QSettings settings;
  window_font_ = settings.value(SettingsKeys::FONT, QFont("Ubuntu Mono", 9)).value<QFont>();
  win->setFont(window_font_);
  QObject::connect(win, SIGNAL(createNewWindow()),
                   this, SLOT(createNewWindow()));

  QObject::connect(&ros_thread_, SIGNAL(connected(bool)),
                   win, SLOT(connected(bool)));

  QObject::connect(this,
                   SIGNAL(fontChanged(const QFont &)),
                   win, SLOT(setFont(const QFont &)));

  QObject::connect(win, SIGNAL(selectFont()),
                   this, SLOT(selectFont()));

  QObject::connect(win, SIGNAL(readBagFile()),
                   &bag_reader_, SLOT(promptForBagFile()));


  if (!ros_thread_.isRunning())
  {
    // There's only one ROS thread, and it services every window.  We need to initialize
    // it and its connections to the LogDatabase when we first create a window, but
    // after that it doesn't need to be modified again.
    QObject::connect(&ros_thread_, SIGNAL(logReceived(const rosgraph_msgs::LogConstPtr& )),
                     &db_, SLOT(queueMessage(const rosgraph_msgs::LogConstPtr&) ));

    QObject::connect(&ros_thread_, SIGNAL(spun()),
                     &db_, SLOT(processQueue()));

    ros_thread_.start();
  }