本文整理汇总了C++中QApplication::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ QApplication::exec方法的具体用法?C++ QApplication::exec怎么用?C++ QApplication::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QApplication
的用法示例。
在下文中一共展示了QApplication::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
// creating an application
QApplication app (argc, argv);
// create an instance of window class
Window window;
// show the window
window.show();
// clean exit
return app.exec();
}
示例2: main
// pretty simple, huh?
int main (int argc, char** argv)
{
QApplication* app = new QApplication (argc, argv);
app->setApplicationName ("SpeechControl");
app->setOrganizationDomain ("thesii.org");
app->setOrganizationName ("Synthetic Intellect Institute");
app->setWindowIcon (QIcon (":/logo/sc-large"));
app->setApplicationVersion (SPCHCNTRL_BUILD_VERSION);
app->setQuitOnLastWindowClosed (false);
SpeechControl::Core appCore (argc, argv, app);
appCore.start();
return app->exec();
}
示例3: main
Q_DECL_EXPORT int main(int argc, char **argv)
{
QApplication *app = MDeclarativeCache::qApplication(argc, argv);
QDeclarativeView *window = MDeclarativeCache::qDeclarativeView();
// Use MDeclarativeCache::applicationDirPath()
// instead of QCoreApplication::applicationDirPath()
// because the latter does not work with the booster.
QDir::setCurrent(MDeclarativeCache::applicationDirPath());
window->setSource(QUrl::fromLocalFile("main.qml"));
window->showFullScreen();
return app->exec();
}
示例4: main
// ---------------------------------------------------------------------------
int main (int argc, char **argv)
{
Set_Epoch (DEFAULT_EPOCH);
Set_Format (DEFAULT_FORMAT);
Load_Arguments (argc, argv);
QApplication app (argc, argv);
Digital_Hexal_Clock *clock = new Digital_Hexal_Clock (epoch, output_format);
// clock->resize (160, 64);
app.setMainWidget (clock);
clock->show();
return app.exec();
} // main
示例5: main
int main (int argc,char *argv[])
{
QApplication a (argc, argv);
QString strStartID = "";
// Set Encoding to Utf-8
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
// using cmd line arguments
if (argc > 1)
{
QString strArgs = QString(argv[1]);
if(strArgs.left(2) == "-s" ) // auto start ID option
{
strStartID = strArgs.remove(0,2);
}
}
Mainview w(0,strStartID);
//check libueye_api Version if working with demo
DWORD ver = is_GetDLLVersion ();
bool bDllVersion = false;
int nDllMajor = ver >> 24;
int nDllMinor = ver >> 16 & 0xff;
if (nDllMajor > DLL_VER_MAJOR)
bDllVersion = true;
else if (nDllMajor == DLL_VER_MAJOR)
{
if (nDllMinor >= DLL_VER_MINOR)
bDllVersion = true;
}
// if DLL version is to old, show a user message and exit the demo
if (!bDllVersion)
{
QMessageBox msgbox;
msgbox.setText(QString("Demo Version %1 don't work with\n"
"libueye_api < %2.%3!\n"
"use a newer libueye!")
.arg(DEMO_VERSION_STR)
.arg(DLL_VER_MAJOR)
.arg(DLL_VER_MINOR));
msgbox.setIcon(QMessageBox::Critical);
msgbox.exec();
return 0;
}
w.show ();
return a.exec ();
}
示例6: visapp3
int visapp3( 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;
}
示例7: emscriptenQtSDLMain
int emscriptenQtSDLMain(int argc, char *argv[])
#endif
{
Q_INIT_RESOURCE(sdi);
QApplication *app = new QApplication(argc, argv);
app->setApplicationName("SDI Example");
app->setOrganizationName("Trolltech");
MainWindow *mainWin = new MainWindow;
#if defined(Q_OS_SYMBIAN)
mainWin->showMaximized();
#else
mainWin->show();
#endif
return app->exec();
}
示例8: main
int main (int argc, char *argv[])
{
int val = 0;
QApplication app (argc, argv);
ApplicationWindow window (&val); // Necessary argument !
Profiler *prof = new Profiler ();
prof->setWindowTitle ("Profil");
window.setProfiler (prof);
if (argc == 2) window.setFile (QString (argv[1]));
window.show ();
return app.exec ();
// return EXIT_SUCCESS;
}
示例9: 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;
}
示例10: emscriptenQtSDLMain
int emscriptenQtSDLMain(int argc, char *argv[])
#endif
{
QApplication *app = new QApplication(argc, argv);
MainWindow *window = new MainWindow;
#if defined(Q_OS_SYMBIAN)
window->showMaximized();
#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
window->show();
#else
window->resize(640, 512);
window->show();
#endif
return app->exec();
}
示例11: a
int
main (int argc, char **argv)
{
QApplication a (argc, argv);
abe *ab = new abe (&argc, argv);
ab->setWindowTitle (VERSION);
a.setStyle (new QPlastiqueStyle);
ab->show ();
return a.exec ();
}
示例12: run
void* UIThread::run(void*)
{
int argc = 1;
QString appPath = UIThread::get()->getAppPath();
const char* cPath = appPath.toStdString().c_str();
const char** argv = &cPath;
QApplication* app = UIThread::get()->app = new QApplication(argc, (char**)argv);
app->setQuitOnLastWindowClosed(false);
UITimer* timer = UIThread::get()->timer = new UITimer();
timer->start(0);
pthread_mutex_unlock(&UIThread::get()->baseReady);
app->exec();
pthread_exit(NULL);
return NULL;
}
示例13: main
int main(int f_argc_i, char *f_argv_p[])
{
if ( f_argc_i < 3 || ( std::string(f_argv_p[1]) != "--left" && std::string(f_argv_p[1]) != "--right" ) )
{
printf("Usage %s --left imgl1 imgl2 ... imglN --right imgr1 imgr2 ... imgrN\n", f_argv_p[0]);
printf("Example: %s --left imgs/*c0*.png --right imgs/*c1*.jpg\n", f_argv_p[0]);
exit(1);
}
QApplication app (f_argc_i, f_argv_p);
/// Initialize application
initialize("Top Level Drawing Lists");
/// Load image filename data in vectors
g_counter_i = 0;
int idx_i = 0;
for (int i = 1; i < f_argc_i; ++i)
{
if (std::string(f_argv_p[i]) == std::string("--left"))
idx_i = 0;
else if (std::string(f_argv_p[i]) == std::string("--right"))
idx_i = 1;
else
{
g_maxImages_i = std::max((int)g_files_v[idx_i].size(), g_maxImages_i);
g_files_v[idx_i].push_back ( f_argv_p[i] );
}
}
g_maxImages_i = std::max((int)g_files_v[idx_i].size(), g_maxImages_i);
/// Set screen count.
setScreenCount ( cv::Size(1,1) );
/// Load first image
loadAndShowFrame ( );
/// Set callback functions
setKeyPressedEventCBF ( &callBackKeyboard );
int retval_i = app.exec();
terminate();
return retval_i;
}
示例14: main
int main(int ac, char** av)
{
int r;
QApplication *QPxTool;
QPxToolMW *mainwin;
QTranslator *translator;
QSplashScreen *splash;
QString locale = QLocale::system().name();
QPixmap *pix;
QPxTool = new QApplication(ac,av);
#ifndef QT_NO_DEBUG
qDebug("Creating splash screen...");
#endif
pix = new QPixmap (":images/splash.png");
splash = new QSplashScreen( *pix );
splash->show();
translator = new QTranslator;
#ifndef QT_NO_DEBUG
qDebug("* Loading translator...");
#endif
#ifdef _WIN32
if (!translator->load("qpxtool."+locale, "locale")) {
#else
if (!translator->load("qpxtool."+locale, INSTALL_PREFIX"/share/qpxtool/locale")) {
#endif
qDebug() << "** Can't load translation for current locale: " << locale;
} else {
QPxTool->installTranslator(translator);
}
QPxTool->setWindowIcon( QIcon(":images/q.png") );
mainwin = new QPxToolMW(ac,av);
splash->finish(mainwin);
mainwin->show();
r = QPxTool->exec();
delete mainwin;
delete translator;
delete splash;
delete pix;
delete QPxTool;
return r;
}
示例15: main
int main(int argc, char *argv[])
{
QApplication app ( argc , argv );
if ( !QGLFormat::hasOpenGL ( ) )
{
std::cerr << "This system has no OpenGL support" << std::endl;
return 1;
}
MainWindow * form = new MainWindow;
form->show ( );
return app.exec ( );
}