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


C++ QCoreApplication::quit方法代码示例

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


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

示例1: start

	void start()
	{
		QCoreApplication *app = application();
		
		QServer* tcpServer = createServer();
		if (tcpServer)
		{
			tcpServer->listen();

			if (!tcpServer->isListening()) {
				logMessage(QString("Failed to bind to port %1").arg(tcpServer->serverPort()), QtServiceBase::Error);
				app->quit();
			}
		}
	}	
开发者ID:Quenii,项目名称:ADCEVM-minor,代码行数:15,代码来源:ElephantService.cpp

示例2: start

void HttpService::start()
{
    QCoreApplication *app = application();

    quint16 port = (app->argc() > 1) ?
        QString::fromLocal8Bit(app->argv()[1]).toUShort() : m_listenPort;
    daemon = new HttpBridger(port, app);

    if (!daemon->isListening()) {
        XERROR("Failed to bind to port %d", daemon->serverPort());
        app->quit();
    }

    if (Configer::getFirsttime())
    {
        //默认设置为自动开启
        setStartupType(QtServiceController::AutoStartup);
        Configer::setFirstTime(false);
    }
}
开发者ID:waterlin,项目名称:WaterMate,代码行数:20,代码来源:HttpService.cpp

示例3: start

void CRadsService::start()
{
	DEBUG_BREAK;

	QCoreApplication *app = application();

	if ( mDaemon )
	{
		delete mDaemon;
		LOG_WARN( "Deleted existing rads-client daemon before starting." );
	}

	mDaemon = new CRadsDaemon( mPaths, app );

	if (!mDaemon->IsListening() )
	{
		const QString msg = "Failed to setup rads-client daemon. Quiting...";
		logMessage( msg, QtServiceBase::Error );
		LOG_FATAL( msg );
		app->quit();
	}
}
开发者ID:BRAT-DEV,项目名称:main,代码行数:22,代码来源:RadsService.cpp

示例4: start

void VlcStreamerService::start()
{
	QSocketNotifier		*snSignal;
	struct sigaction	act;

	QCoreApplication *app = application();

	snSignal = new QSocketNotifier(_sigFd[1], QSocketNotifier::Read);
	QObject::connect(snSignal, SIGNAL(activated(int)), app, SLOT(quit()));
	
	act.sa_handler = _Handler;
	sigemptyset(&act.sa_mask);
	act.sa_flags = SA_RESTART;
	sigaction(SIGINT, &act, 0);
	sigaction(SIGTERM, &act, 0);

	_app = new VlcStreamerApp();
	if(_app->Setup()) {
		QObject::connect(app, SIGNAL(aboutToQuit()), _app, SLOT(Stop()));
		return;
	}
	app->quit();
}
开发者ID:mcgouganp,项目名称:VLCStreamer,代码行数:23,代码来源:VlcStreamerService.cpp

示例5: main

int main(int argc, char* argv[])
{
	QCoreApplication::setOrganizationName("rapcad");
	QCoreApplication::setOrganizationDomain("rapcad.org");
	QCoreApplication::setApplicationName("RapCAD");
	QCoreApplication::setApplicationVersion(STRINGIFY(RAPCAD_VERSION));

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

	QCommandLineParser p;
	p.setApplicationDescription(QCoreApplication::translate("main","RapCAD the rapid prototyping IDE"));
	p.addHelpOption();
	p.addVersionOption();
	p.addPositionalArgument("filename", QCoreApplication::translate("main","File to open or process."));

	QCommandLineOption testOption(QStringList() << "t" << "test", QCoreApplication::translate("main","Run through tests in working directory."));
	p.addOption(testOption);

	QCommandLineOption compareOption(QStringList() << "c" << "compare", QCoreApplication::translate("main","Compare two files to see if they are identical."),"filename");
	p.addOption(compareOption);

	QCommandLineOption printOption(QStringList() << "p" << "print", QCoreApplication::translate("main","Print debugging output."));
	p.addOption(printOption);

	QCommandLineOption outputOption(QStringList() << "o" << "output",QCoreApplication::translate("main","Create output file <filename>."),"filename");
	p.addOption(outputOption);

#ifdef USE_READLINE
	QCommandLineOption interactOption(QStringList() << "i" << "interactive",QCoreApplication::translate("main","Start an interactive session"));
	p.addOption(interactOption);
#endif
	p.process(*a);

	QStringList inputFiles=p.positionalArguments();
	QString inputFile;
	if(!inputFiles.isEmpty())
		inputFile=inputFiles.at(0);

	QString outputFile;
	if(p.isSet(outputOption))
		outputFile=p.value(outputOption);
	else if(p.isSet(compareOption))
		outputFile=p.value(compareOption);

	QTextStream output(stdout);
	Strategy* s=NULL;
	if(p.isSet(compareOption)) {
		Comparer* c=new Comparer(output);
		c->setup(inputFile,outputFile);
		s=c;
	} else if(p.isSet(testOption)) {
		s=new Tester(output);
	} else if(p.isSet(outputOption)||p.isSet(printOption)) {
		Worker* w=new Worker(output);
		bool print = p.isSet(printOption);
		w->setup(inputFile,outputFile,print,false);
		s=w;
#ifdef USE_READLINE
    } else if(p.isSet(interactOption)) {
        showVersion(output);
		s=new Interactive(output);
#endif
	}

	if(s) {
		int retcode=s->evaluate();
		a->quit();
		return retcode;
	} else {
		delete a;
		a=new QApplication(argc,argv);
		return showUi(a,inputFiles);
	}
}
开发者ID:UIKit0,项目名称:RapCAD,代码行数:74,代码来源:main.cpp


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