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


C++ QApplication::connect方法代码示例

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


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

示例1: main

int main ( int argc, char ** argv )
{
  QApplication app ( argc, argv );
  
  PasswordImpl pwd;
  if ( pwd.exec() ==QDialog::Accepted ) {
    DialogImpl win;
    win.show();
    app.connect ( &app, SIGNAL ( lastWindowClosed() ), &app, SLOT ( quit() ) );
    return app.exec();
  }
  app.connect ( &app, SIGNAL ( lastWindowClosed() ), &app, SLOT ( quit() ) );
  
  return 1;
}
开发者ID:vdg1,项目名称:cs8-components,代码行数:15,代码来源:main.cpp

示例2: main

int main(int argc, char * argv[])
{
	ULogger::setType(ULogger::kTypeConsole);
	ULogger::setLevel(ULogger::kInfo);

	QApplication * app = new QApplication(argc, argv);
	DatabaseViewer * mainWindow = new DatabaseViewer();

	mainWindow->showNormal();

	if(argc == 2)
	{
		mainWindow->openDatabase(argv[1]);
	}

	// Now wait for application to finish
	app->connect( app, SIGNAL( lastWindowClosed() ),
				app, SLOT( quit() ) );
	app->exec();// MUST be called by the Main Thread

	delete mainWindow;
	delete app;

	return 0;
}
开发者ID:rcxking,项目名称:wpi_sample_return_robot_challenge,代码行数:25,代码来源:main.cpp

示例3: mainAdapterWidget

int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments)
{
    // load the scene.
    osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
    if (!loadedModel)
    {
        std::cout << arguments[0] <<": No data loaded." << std::endl;
        return 1;
    }
    
    std::cout<<"Using AdapterWidget - QGLWidget subclassed to integrate with osgViewer using its embedded graphics window support."<<std::endl;

        ViewerQT* viewerWindow = new ViewerQT;

        viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
        viewerWindow->setSceneData(loadedModel.get());

        viewerWindow->show();
  
    
    
    a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
   
    return a.exec();
}
开发者ID:flyskyosg,项目名称:pantocrator,代码行数:25,代码来源:AdapterWidget.cpp

示例4: main

/*! \mainpage Raymini Documentation
 *
 * \section intro_sec Introduction
 * RayMini is a minimal raytracer implemented in C++/OpenGL/Qt.
 * This software package is meants to be distributed to Telecom ParisTech student only.
 * \section install_sec Installation
 *
 * \subsection tools_subsec Tools required:
 * <ul>  
 * <li>GCC >v4 </li>
 * <li> OpenGL </li>
 * <li> QT >v4.4 </li>
 * <li> libQGLViewer </li>
 * <li> GLEW (for GPU extensions) </li>
 * </ul>
 * <VAR> 
 * Edit the file raymini.pro to adapt it to your configuration (has been tested under Linux Ubuntu, Linux Fedora and Win7).
 * </VAR>
 *
 * \subsection running Running the program
 * - On linux: 
 *    -# qmake-qt4 raymini.pro
 *    -# make
 *    -# ./raymini
 * 
 *
 * - On windows:
 *    <BR> Use QT Creator and do not forget to setup the run configuration properly so that the raymini directory is the working directory. 
 *    <BR> Otherwise, the 'models' directory will not be found by the raymini executable.
 *    <BR> If you want to run the executable directly (by double-clikcing on it in the Windows file explorer), copy the model directory into the release directory first 
 *     and double-click on raymini.exe. 
 *
 * \section authors Authors
 *  - Tamy Boubekeur    ([email protected])
 *  - Junxian Xu        ([email protected])
 *  - Maxim Karpushin   ([email protected])
 *  - Tiago C. Silva    ([email protected])
 *  - Vinicius Gardelli ([email protected])
 */
int main (int argc, char **argv)
{

  try {
  QApplication raymini (argc, argv);

  setBoubekQTStyle (raymini);
  QApplication::setStyle (QStyleFactory::create("fusion"));
  raymini.setAttribute(Qt::AA_DontUseNativeMenuBar,true);

  Window * window = new Window ();
  window->setWindowTitle ("RayMini: A minimal raytracer.");
  window->show();
  raymini.connect (&raymini, SIGNAL (lastWindowClosed()), &raymini, SLOT (quit()));

  return raymini.exec ();
  }
  catch (exception e)
  {
    cerr << e.what() << endl;
    //exit (1);
  }
  catch (Mesh::Exception e)
  {
    cerr << e.getMessage() << endl;
    //exit (1);
  }
}
开发者ID:elfprincexu,项目名称:RayMini,代码行数:67,代码来源:Main.cpp

示例5: main

int main (int argc, char *argv[]) {
  try{
    Tribots::ConfigReader cfg;
    std::string cfg_file = "../config_files/teamcontrol.cfg";
    if (argc>1) {
      if (std::string(argv[1])=="--help" || std::string(argv[1])=="-h") {
        std::cout << "Aufruf: " << argv[0] << " [Konfigurationsdatei]\n";
        std::cout << "Fehlt die Konfigurationsdatei, wird ../config_files/teamcontrol.cfg verwendet\n";
        return -1;
      } else {
        cfg_file = argv[1];
      }
    }
    cfg.append_from_file (cfg_file.c_str());
    QApplication app (argc,argv);

    Tribots::Journal::the_journal.set_mode (cfg);

    TeamcontrolMainWidget tcw (0);
    tcw.init (cfg);
    app.connect( &tcw, SIGNAL(widgetClosed()), &app, SLOT(quit()) );
    tcw.show();

    return app.exec ();
  }catch (Tribots::TribotsException& e) {
    std::cerr << e.what() << '\n';
    return -1;
  }catch (std::exception& e) {
    std::cerr << e.what() << '\n';
    return -1;
  }
}
开发者ID:Sean3Don,项目名称:opentribot,代码行数:32,代码来源:main.cpp

示例6: main

int main(int argc, char *argv[])
{
	/* look for dynamic linker */
	try {
		static Genode::Rom_connection rom("ld.lib.so");
		Genode::Process::dynamic_linker(rom.dataspace());
	} catch (...) { }

	int result;

	QApplication *a = new QApplication(argc, argv);

	Qt_launchpad *launchpad = new Qt_launchpad(Genode::env()->ram_session()->quota());

	launchpad->add_launcher("calculatorform", 18*1024*1024);
	launchpad->add_launcher("tetrix",         18*1024*1024);

	launchpad->move(300,100);
	launchpad->show();

	a->connect(a, SIGNAL(lastWindowClosed()), a, SLOT(quit()));

	result = a->exec();

	delete launchpad;
	delete a;

	return result;
}
开发者ID:Acidburn0zzz,项目名称:genode,代码行数:29,代码来源:main.cpp

示例7: main

int main( int argc, char ** argv )
{   
	 hw = new HWSRV(1); 
	 int error = hw->ErrNum;
	 QApplication a (argc, argv);
	 QDesktopWidget * d = a.desktop();
	 int resolution_width = d->width();  
	 int resolution_heigth = d->height();
	 w = new Configurations; 
	 int wid = w->width(); 
	 int heig = w->height();
	 if ((wid>resolution_width)||(heig>resolution_heigth)){
		  w->setWindowState(Qt::WindowFullScreen);
		  w->setMinimumSize(QSize(resolution_width,resolution_heigth));
		  w->setMaximumSize(QSize(resolution_width,resolution_heigth));
		  w->adjustSize();
	 }
	 w -> show();
	 a. processEvents();
	 a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
	 sigset(SIGUSR1,catch_sig);
	 if (error>2){
		  QString er_str;
		  QString er_id;
		  HWSRVErrorText(error,er_str,er_id);
		  InterfaceErrorWin(er_str, er_id);
		  return error;
	 }
	 int ret = a.exec(); 
	 return ret;
}
开发者ID:oldbay,项目名称:dnc_kassa,代码行数:31,代码来源:main.cpp

示例8: main

int main(int argc, char ** argv)
{
    QApplication * app = new QApplication(argc, argv);

    int cx = -1;
    int cy = -1;
    int w = QApplication::desktop()->width();
    int h = QApplication::desktop()->height();

    QSettings settings(QSettings::IniFormat, QSettings::UserScope, "DoUML", "settings");
    settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
    int uid = settings.value("Main/id", -1).toInt();
    int l, t, r, b;
    l = settings.value("Desktop/left", -1).toInt();
    r = settings.value("Desktop/right", -1).toInt();
    t = settings.value("Desktop/top", -1).toInt();
    b = settings.value("Desktop/bottom", -1).toInt();

    if(l != -1 && r != -1 && t != -1 && b != -1)
    {
      if (!((r == 0) && (t == 0) && (r == 0) && (b == 0)) &&
          !((r < 0) || (t < 0) || (r < 0) || (b < 0)) &&
          !((r <= l) || (b <= t)))
      {
        cx = (r + l) / 2;
        cy = (t + b) / 2;
        w = r - l;
        h = b - t;
      }
    }

    if (uid == -1)
        QMessageBox::critical(0, "Synchro project", "Own identifier not defined");
    else if ((uid < 2) || (uid > 127))
        QMessageBox::critical(0, "Synchro project", "invalid Identifier");
    else {
        set_user_id(uid, homeDir.dirName());
        app->connect(app, SIGNAL(lastWindowClosed()), SLOT(quit()));
        init_pixmaps();

        SynchroWindow * ww = new SynchroWindow();

        ww->resize((w * 3) / 5, (h * 3) / 5);

        if (cx != -1)
            ww->move(ww->x() + cx - (ww->x() + ww->width() / 2),
                     ww->y() + cy - (ww->y() + ww->height() / 2));

        ww->show();

        if (argc > 1)
            ww->load(argc - 1, argv + 1);

        app->exec();
    }

    return 0;
}
开发者ID:jeremysalwen,项目名称:douml,代码行数:58,代码来源:main.cpp

示例9: main

int main ( int argc, char **argv )
{
	QApplication app ( argc, argv );

	QCardReader *qcr = new QCardReader();
	qcr->show();

	app.connect ( &app, SIGNAL ( lastWindowClosed() ), &app, SLOT ( quit() ) );
	return app.exec();
}
开发者ID:BackupTheBerlios,项目名称:kcardreader-svn,代码行数:10,代码来源:main.cpp

示例10: main

int main(int argc, char **argv) {

    /*********************
    ** Qt
    **********************/
    QApplication* app = 0;
    StructureGL* glWindow = 0;
    app = new QApplication(argc, argv);
    glWindow = new StructureGL();
    GuiNode n(argc, argv);
    n.init(glWindow);
    glWindow->show();
    app->connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit()));
    app->connect(&n, SIGNAL(finished()), app, SLOT(quit()));
    int result = app->exec();
    n.stop();
    n.wait();
	return result;
}
开发者ID:ahertle,项目名称:structure_coloring_fkie,代码行数:19,代码来源:GuiMain.cpp

示例11: main

int main (int argc, char **argv)
{
  QApplication raymini (argc, argv);
  setBoubekQTStyle (raymini);
  QApplication::setStyle (new QPlastiqueStyle);
  Window * window = new Window ();
  window->setWindowTitle ("RayMini: A minimal raytracer.");
  window->show();
  raymini.connect (&raymini, SIGNAL (lastWindowClosed()), &raymini, SLOT (quit()));
  
  return raymini.exec ();
}
开发者ID:audreyTPT,项目名称:Test,代码行数:12,代码来源:Main.cpp

示例12: main

int main(int argc,char *argv[]) {
	int retval = 0;

	/* Initialize rtdk */
	#ifdef _RTUTILS_H
	rt_print_auto_init(1);
	#endif

	/* Try to Exit Cleanly on Signals */
	parentThread = getpid();
	signal(SIGINT,signal_handler);
	signal(SIGABRT,signal_handler);
	signal(SIGSEGV,signal_handler);

	/* Handle Command-Line Options */
	cli_options_t cli_options;
	if (!parse_cli_options(argc,argv,&cli_options))
		return -EINVAL;

	/* Find Configuration File */
	std::string config_file;
	if (cli_options.config_file.length())
		config_file = cli_options.config_file;
	else if (getenv("RTXI_CONF"))
		config_file = getenv("RTXI_CONF");
	else
		config_file = "/etc/rtxi.conf";

	/************************************************************
	 * Create Main System Components                            *
	 *                                                          *
	 *  These need to be created early because they should have *
	 *  Settings::IDs of 0 and 1.                               *
	 ************************************************************/

	/* Create GUI Objects */
	QApplication *app = new QApplication(argc,argv);
	app->connect(app,SIGNAL(lastWindowClosed()),app,SLOT(quit()));
	MainWindow::getInstance()->showMaximized();

	CmdLine::getInstance();
	RT::System::getInstance();
	IO::Connector::getInstance();

	/* Bootstrap the System */
	Settings::Manager::getInstance()->load(config_file);
	retval = app->exec();

	Plugin::Manager::getInstance()->unloadAll();
	return retval;
}
开发者ID:misterboyle,项目名称:rtxi,代码行数:51,代码来源:main.cpp

示例13: visapp1

int visapp1( int argc, char** argv )
{
 	logger::need_to_log(/*true*/);

    QApplication app (argc, argv);
    app.setQuitOnLastWindowClosed(false);
    async_services_initializer init(true);
    
    __main_srvc__ = &init.get_service();

    logging::add_console_writer();
    logging::add_default_file_writer();


    //cmd_line::arg_map am;
    //if (!am.parse(cmd_line::naive_parser().add_arg("task_id", true), argc, argv))
    //{
    //    LogError("Invalid command line");
    //    return 1;
    //}

    //optional<binary::size_type> task_id;
    //if (am.contains("task_id")) 
    //    task_id = am.extract<binary::size_type>("task_id");

    try
    {
        endpoint peer(cfg().network.local_address);

        kernel::vis_sys_props props_;
        props_.base_point = ::get_base();

        visapp s(peer, props_ , argc, argv);

        tray_icon tricon(":/resources/projector.png", &app);
        app.connect(&tricon, SIGNAL(menu_exit()), &app, SLOT(quit()));    
        tricon.show();

        return app.exec();
    }
    catch(const boost::filesystem::filesystem_error& e)
    {
        auto c = e.code().message();
        LogError(c);
    }

	return 0; 

}
开发者ID:yaroslav-tarasov,项目名称:test_osg,代码行数:49,代码来源:visapp1.cpp

示例14: mainAdapterWidget

int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments) {
  // load the scene.
  osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
  if (!loadedModel) {
    std::cerr << arguments[0] << ": No data loaded." << std::endl;
    std::cout << "usage: " << arguments[0] << " [--mdi] nodefile" << std::endl;
    return 1;
  }

  std::cout << "Using AdapterWidget - QGLWidget subclassed to integrate with "
               "osgViewer using its embedded graphics window support."
            << std::endl;

  if (arguments.read("--mdi")) {
    std::cout << "Using ViewetQT MDI version" << std::endl;
    /*
         Following problems are found here:
         - miminize causes loaded model to disappear (some problem with Camera
       matrix? - clampProjectionMatrix is invalid)
         */
    ViewerQT* viewerWindow = new ViewerQT;
    viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
    viewerWindow->setSceneData(loadedModel.get());

    QMainWindow* mw = new QMainWindow();
    QMdiArea* mdiArea = new QMdiArea(mw);
    mw->setCentralWidget(mdiArea);

    QMdiSubWindow* subWindow = mdiArea->addSubWindow(viewerWindow);
    subWindow->showMaximized();
    subWindow->setWindowTitle("New Window");
    mw->show();
  } else {
    ViewerQT* viewerWindow = new ViewerQT;
    viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
    viewerWindow->setSceneData(loadedModel.get());
    viewerWindow->show();
  }

  a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
  return a.exec();
}
开发者ID:Mizux,项目名称:viewer,代码行数:42,代码来源:adapter_widget.cpp

示例15: while

QApplication *QApplication_new (char **argv)
{
  QApplication *app;
  int argc = 0;
  char **my_argv;
  int i;

  while (argv[argc] != 0)
    argc++;

  my_argv = (char**)___alloc_mem ((argc+1) * sizeof (char*));
  for (i=0; i<argc; i++)
    my_argv[i] = strcpy ((char*)___alloc_mem (strlen (argv[i]) + 1),
                         argv[i]);
  my_argv[i] = 0;

  qInstallMsgHandler( myMessageOutput );
  app = new QApplication (argc, my_argv);

  app->connect (app, SIGNAL(lastWindowClosed()), app, SLOT(quit()));

  return app;
}
开发者ID:OpenEngineDK,项目名称:other-gambit,代码行数:23,代码来源:guide.cpp


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