コード例 #1
0
int
main(int argc, char** argv)
{
  //  Create the qt application object needed for the visualization.
  QApplication application(argc, argv);
  QObject::connect(&application, SIGNAL(lastWindowClosed()), &application, SLOT(quit()));

  //  The QtWindow class contains the main window needed for the visualization.
  QtWindow* window;

  //  Initialization of the coin 3D libraries which are needed for the visualization of the robot scenes.
  SoQt::init(window);
  SoDB::init();

  //  Create the TutorialPlanSystem class which contains our roblib plan system.
  boost::shared_ptr<TutorialPlanSystem> system(new TutorialPlanSystem());

  //  Create our main visualization window and pass our TutorialPlanSystem to the constructor.
  window = QtWindow::instance(system.get());

  //  Show the main visualization window to the user.
  window->show();

  //  Run the qt application.
  return application.exec();
}
コード例 #2
0
ファイル: QtMain.cpp プロジェクト: JamesLinus/pianobooster
int main(int argc, char *argv[])
{

    QApplication app(argc, argv);

     QString locale = QLocale::system().name();
     printf("locale = %s\n", qPrintable(locale));

    QString localeDirectory =
#ifdef Q_OS_WIN32
        QApplication::applicationDirPath() + "/translations/";
#endif
#ifdef Q_OS_LINUX
        QApplication::applicationDirPath() + "/../share/" + QSTR_APPNAME + "/translations/";
#endif
#ifdef Q_OS_DARWIN
        QApplication::applicationDirPath() + "/../Resources/translations/";
#endif


     QTranslator translator;
     if (!translator.load(QSTR_APPNAME + QString("_") + locale , localeDirectory))
        if (!translator.load(QSTR_APPNAME + QString("_") + locale, QApplication::applicationDirPath()  + "/translations/"))
            translator.load(QSTR_APPNAME + QString("_") + locale, QApplication::applicationDirPath());

     app.installTranslator(&translator);



    if (!QGLFormat::hasOpenGL()) {
        QMessageBox::information(0, QMessageBox::tr("OpenGL support"),
                 QMessageBox::tr("This system does not support OpenGL which is needed to run Piano Booster."));
        return -1;
    }

	QtWindow window;
    window.show();
	_window=&window;

    int value = app.exec();
    closeLogs();
    return value;
}