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


C++ QApplication类代码示例

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


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

示例1: main

int main(int argc, char** argv)
{
	bool d = (argc > 1 && strcmp(argv[1], "-d") == 0) ? true : false;
	QApplication *app = new QApplication(argc, argv);
	app->setOrganizationName("F-list.net");
	app->setOrganizationDomain("www.f-list.net");
	app->setApplicationName("F-list Messenger");
	globalInit();
	QFile stylefile("default.qss");
	stylefile.open(QFile::ReadOnly);
	QString stylesheet = QLatin1String(stylefile.readAll());
	app->setStyleSheet(stylesheet);
	flist_messenger::init();
	flist_messenger *fmessenger = new flist_messenger(d);
	fmessenger->show();
	return app->exec();
	//todo: globalQuit();
}
开发者ID:kythyria,项目名称:flist-messenger,代码行数:18,代码来源:main.cpp

示例2: showSplashScreen

/*----------------------------------------------------------------------------
** Function    : showSplashScreen
** Description : This function shows Show splash - on starting
** Precondition:  None
** Postcondition: Splash Screen is shown onto the screen
** Parameters  : refrence to QApplication &a
                 refrence to MainWindow& w
** Return value: None
**--------------------------------------------------------------------------*/
void MainWindow::showSplashScreen(QApplication& a, MainWindow& w)
{
    //QPixmap pixmap(":/Images/Images/designer.png");
    QPixmap pixmap(":/Images/Images/vscp_bumblebee.png");
    QSplashScreen splash(pixmap);
    splash.show();

    splash.showMessage(QObject::tr(" uiMagician .. \n Author : Dinesh Guleria"),
                        Qt::AlignLeft | Qt::AlignTop, Qt::black);  //This line represents the alignment of text, color and position
    // Add a delay
    SleepTimerDelay::sleep(1);
    // Clear the splash mesage
    splash.clearMessage();
    //Display Another message
    splash.showMessage(QObject::tr("Initiating your program now..."),
                        Qt::AlignRight | Qt::AlignBottom, Qt::black);  //This line represents the alignment of text, color and position
    //This is used to accept a click on the screen so that user can cancel the screen
    a.processEvents();
    // Add a delay
    SleepTimerDelay::sleep(1);
    //Splash finished
    splash.finish(&w);

}
开发者ID:dinguluer,项目名称:UiMagician,代码行数:33,代码来源:mainWindowInitialisation.cpp

示例3: test_run

int test_run(void *papp)
{
	QApplication *app = (QApplication *)papp;
	return app->exec();		
}
开发者ID:edgarliu,项目名称:easygx,代码行数:5,代码来源:test_qt.cpp

示例4: main

int main (int argc, char **argv)
{
   int           opt;
   int           temp_int;
   int           option_index = 0;
   
   bool          bOptionHelp = false;
        
   /* Create application instance */
   //   QApplication::setStyle( new QWindowsStyle );
   QApplication qapp (argc, argv);

   /* Print the version number */
   displayVersion();

   // create the data location manager (with user data under ~/.showeq
   DataLocationMgr dataLocMgr(".showeq");

   /* Initialize the parameters with default values */
   QFileInfo configFileDefInfo = dataLocMgr.findExistingFile(".", "seqdef.xml",
							     true, false);
   
   if (!configFileDefInfo.exists())
   {
     fprintf(stderr, 
	     "Fatal: Couldn't find seqdef.xml!\n"
	     "\tDid you remember to do 'make install'\n");
     exit(-1);
   }

   QString configFileDef = configFileDefInfo.absFilePath();

   QFileInfo configFileInfo = dataLocMgr.findWriteFile(".", "showeq.xml",
						       true, true);

   // deal with funky border case since we may be running setuid
   QString configFile;
   if (configFileInfo.dir() != QDir::root())
     configFile = configFileInfo.absFilePath();
   else
     configFile = QFileInfo(dataLocMgr.userDataDir(".").absPath(),
			    "showeq.xml").absFilePath();

   // scan command line arguments for a specified config file
   int i = 1;
   while (i < argc)
   {
      if ((argv[i][0] == '-') && (argv[i][1] == 'o'))
         configFile = argv[i + 1];

      i ++;
   }

   /* NOTE: See preferencefile.cpp for info on how to use prefrences class */
   printf("Using config file '%s'\n", (const char*)configFile);
   pSEQPrefs = new XMLPreferences(configFileDef, configFile);

   showeq_params = new ShowEQParams;

   QString section;

   section = "Interface";
   /* Allow map depth filtering */
   showeq_params->retarded_coords  = pSEQPrefs->getPrefBool("RetardedCoords", section, 0);
   showeq_params->systime_spawntime = pSEQPrefs->getPrefBool("SystimeSpawntime", section, false);
   showeq_params->pvp = pSEQPrefs->getPrefBool("PvPTeamColoring", section, false);
   showeq_params->deitypvp = pSEQPrefs->getPrefBool("DeityPvPTeamColoring", section, false);
   showeq_params->keep_selected_visible = pSEQPrefs->getPrefBool("KeepSelected", section, true);

   section = "Misc";
   showeq_params->fast_machine = pSEQPrefs->getPrefBool("FastMachine", section, true);
   showeq_params->createUnknownSpawns = pSEQPrefs->getPrefBool("CreateUnknownSpawns", section, true);

   showeq_params->walkpathrecord = pSEQPrefs->getPrefBool("WalkPathRecording", section, false);
   showeq_params->walkpathlength = pSEQPrefs->getPrefInt("WalkPathLength", section, 25);
   /* Tells SEQ whether or not to display casting messages (Turn this off if you're on a big raid) */

   section = "SpawnList";
   showeq_params->showRealName = pSEQPrefs->getPrefBool("ShowRealName", section, false);

   /* Different files for different kinds of raw data */

   section = "SaveState";
   showeq_params->saveZoneState = 
     pSEQPrefs->getPrefBool("ZoneState", section, 1);
   showeq_params->savePlayerState = 
     pSEQPrefs->getPrefBool("PlayerState", section, 1);
   showeq_params->saveSpawns = pSEQPrefs->getPrefBool("Spawns", section, false);
   showeq_params->saveSpawnsFrequency = 
     pSEQPrefs->getPrefInt("SpawnsFrequency", section, (120 * 1000));
   showeq_params->restorePlayerState = false;
   showeq_params->restoreZoneState = false;
   showeq_params->restoreSpawns = false;
   showeq_params->saveRestoreBaseFilename = dataLocMgr.findWriteFile("tmp", pSEQPrefs->getPrefString("BaseFilename", section, "last")).absFilePath();

   /* Parse the commandline for commandline parameters */
   while ((opt = getopt_long( argc,
                              argv,
                              OPTION_LIST,
                              option_list,
//.........这里部分代码省略.........
开发者ID:xbackupx,项目名称:showeqx,代码行数:101,代码来源:main.cpp

示例5: saisieAppuisInitQT_main

int saisieAppuisInitQT_main(QApplication &app, int argc, char *argv[])
{
    app.setApplicationName("SaisieAppuisInitQT");
    app.setOrganizationName("Culture3D");

    QStringList cmdline_args = QCoreApplication::arguments();

    if (cmdline_args.back().contains("help"))
    {
        QString help = "Mandatory unnamed args :\n"
                 "* string :: {Full name (Dir+Pattern)}\n"
                 "* string :: {Orientation ; NONE if not used}\n"
                 "* string :: {Point name, or point file name}\n"
                 "* string :: {Output}\n\n"
                "Named args :\n"
                "* [Name=SzW] Pt2di :: {Sz of window}\n"
                "* [Name=NbF] Pt2di :: {Nb of sub window}\n"
                "* [Name=NameAuto] string :: {Prefix for automatic point creation}\n"
                //"* [Name=Pref2Add] string :: {Prefix to add during import (for bug correction ?)}\n"
                "* [Name=ForceGray] bool :: {Force gray image, def=false}\n"
                "* [Name=OriMode] string :: {Orientation type (GRID) (Def=Std)}\n"
                "* [Name=ZMoy] REAL :: {Average Z, Mandatory in PB}\n"
                "* [Name=ZInc] REAL :: {Incertitude on Z, Mandatory in PB}\n\n"

                "Example:\nmm3d " + app.applicationName() + " IMG_558{0-9}[1].tif RadialBasic 100 measures.xml\n\n"
                "NB: visual interface for argument edition available with command:\n\n mm3d v" + app.applicationName() + "\n\n";

        return helpMessage(app, help);
    }

    loadTranslation(app);

    QSettings settings(QApplication::organizationName(), QApplication::applicationName());

    if ((argc>0)&&(string(argv[0]).find("SaisieQT")!= string::npos))
    {
        argv++;
        argc--;
    }

    Pt2di aSzWin(800,800);
    Pt2di aNbFen(-1,-1);

    string aFullName, aDir, aName, aNamePt, aNameOut;   //mandatory arguments
    string aNameOri, aModeOri, aNameAuto, aPrefix2Add;  //named args
    aPrefix2Add = "";
    bool aForceGray = false;

    settings.beginGroup("Misc");
    aNameAuto = settings.value("defPtName", QString("100")).toString().toStdString();
    settings.endGroup();

    settings.beginGroup("Drawing settings");
    aForceGray = settings.value("forceGray", false       ).toBool();
    settings.endGroup();

    double aZInc, aZMoy;

    if (argv[0][0] == 'v')
    {
        MMVisualMode = true;
        argv[0] = (char*) "SaisieAppuisInitQT";
    }
    
    std::string aInputSec;

    SaisieAppuisInit(argc, argv, aSzWin, aNbFen, aFullName, aDir, aName, aNamePt, aNameOri, aModeOri, aNameOut, aNameAuto, aPrefix2Add, aForceGray, aZMoy, aZInc,aInputSec);

    if (!MMVisualMode)
    {
        if (!checkNamePt( QString (aNamePt.c_str()))) return -1;

        QStringList filenames = getFilenames(aDir, aName);

        int aNbW = aNbFen.x * aNbFen.y;
        if (filenames.size() < aNbW)
        {
             aNbW = filenames.size();

             cVirtualInterface::ComputeNbFen(aNbFen, aNbW);
        }

        updateSettings(settings, aSzWin,aNbFen, aForceGray);

        settings.beginGroup("Misc");
        settings.setValue("defPtName", QString(aNameAuto.c_str()));
        settings.endGroup();

        QStringList input;
        input   << QString(MMDir().c_str()) + QString("bin/SaisiePts")
                << QString(MMDir().c_str()) + QString("include/XML_MicMac/SaisieInitiale.xml")
                << QString("DirectoryChantier=") + QString(aDir.c_str())
                << QString("+Image=") +  QString(aName.c_str())
                << QString("+Ori=") + QString(aNameOri.c_str())
                << QString("+NamePt=") + QString(aNamePt.c_str())
                << QString("+NameAuto=") + QString(aNameAuto.c_str())
                << QString("+Sauv=") + QString(aNameOut.c_str())
                << QString("+SzWx=") + QString::number(aSzWin.x)
                << QString("+SzWy=") + QString::number(aSzWin.y)
                << QString("+NbFx=") + QString::number(aNbFen.x)
//.........这里部分代码省略.........
开发者ID:jakexie,项目名称:micmac-archeos,代码行数:101,代码来源:saisieAppuisInitQT_main.cpp

示例6: main

int main (int argc, char *argv[]) {
	QApplication app (argc, argv);
	QStringList args = app.arguments ();
	if (!args.isEmpty ()) args.pop_front ();	// The command itself
	qputenv ("DESKTOP_STARTUP_ID", qgetenv ("STARTUP_ID_COPY"));	// for startup notifications (set via rkward.desktop)
	qputenv ("STARTUP_ID_COPY", "");

	// Parse arguments that need handling in the wrapper
	bool usage = false;
	QStringList debugger_args;
	QStringList file_args;
	bool reuse = false;
	bool warn_external = true;
	QString r_exe_arg;
	int debug_level = 2;

	for (int i=0; i < args.size (); ++i) {
		if (args[i] == "--debugger") {
			args.removeAt (i);
			while (i < args.size ()) {
				QString arg = args.takeAt (i);
				if (arg == "--") break;
				debugger_args.append (arg);
			}
			if (debugger_args.isEmpty ()) usage = true;
		} else if (args[i] == "--r-executable") {
			if ((i+1) < args.size ()) {
				r_exe_arg = args.takeAt (i + 1);
			} else usage = true;
			args.removeAt (i);
			--i;
		} else if (args[i] == "--debug-level") {
			if ((i+1) < args.size ()) {
				debug_level = args[i+1].toInt ();
			}
		} else if (args[i] == "--reuse") {
			reuse = true;
		} else if (args[i] == "--nowarn-external") {
			warn_external = false;
		} else if (args[i].startsWith ("--")) {
			// all RKWard and KDE options (other than --reuse) are of the for --option <value>. So skip over the <value>
			i++;
		} else {
			QUrl url (args[i]);
			if (url.isRelative ()) {
				file_args.append (QDir::current ().absoluteFilePath (url.toLocalFile ()));
			} else {
				file_args.append (args[i]);
			}
		}
	}

	if (reuse) {
		if (!QDBusConnection::sessionBus ().isConnected ()) {
			if (debug_level > 2) qDebug ("Could not connect to session dbus");
		} else {
			QDBusInterface iface (RKDBUS_SERVICENAME, "/", "", QDBusConnection::sessionBus ());
			if (iface.isValid ()) {
				QDBusReply<void> reply = iface.call ("openAnyUrl", file_args, warn_external);
				if (!reply.isValid ()) {
					if (debug_level > 2) qDebug ("Error while placing dbus call: %s", qPrintable (reply.error ().message ()));
					return 1;
				}
				return 0;
			}
		}
	}

	// MacOS may need some path adjustments, first
#ifdef Q_WS_MAC
	QString oldpath = qgetenv ("PATH");
	if (!oldpath.contains (INSTALL_PATH)) {
		//ensure that PATH is set to include what we deliver with the bundle
		qputenv ("PATH", QString ("%1/bin:%1/sbin:%2").arg (INSTALL_PATH).arg (oldpath).toLocal8Bit ());
		if (debug_level > 3) qDebug ("Adjusting system path to %s", qPrintable (qgetenv ("PATH")));
	}
	// ensure that RKWard finds its own packages
	qputenv ("R_LIBS", R_LIBS);
	QProcess::execute ("launchctl", QStringList () << "load" << "-w" << INSTALL_PATH "/Library/LaunchAgents/org.freedesktop.dbus-session.plist");
#endif

	// Locate KDE and RKWard installations
	QString kde4_config_exe = findExeAtPath ("kde4-config", QDir::currentPath ());
	if (kde4_config_exe.isNull ()) kde4_config_exe = findExeAtPath ("kde4-config", app.applicationDirPath ());
	if (kde4_config_exe.isNull ()) kde4_config_exe = findExeAtPath ("kde4-config", QDir (app.applicationDirPath ()).filePath ("KDE/bin"));
	if (kde4_config_exe.isNull ()) {
#ifdef Q_WS_WIN
	QStringList syspath = QString (qgetenv ("PATH")).split (';');
#else
	QStringList syspath = QString (qgetenv ("PATH")).split (':');
#endif
		for (int i = 0; i < syspath.size (); ++i) {
			kde4_config_exe = findExeAtPath ("kde4-config", syspath[i]);
			if (!kde4_config_exe.isNull ()) break;
		}
	}

	if (kde4_config_exe.isNull ()) {
		QMessageBox::critical (0, "Could not find KDE installation", "The KDE installation could not be found (kde4-config). When moving / copying RKWard, make sure to copy the whole application folder, or create a shorcut / link, instead.");
		exit (1);
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:rkward,代码行数:101,代码来源:rkward_startup_wrapper.cpp

示例7: main

int main(int argc, char **argv){
    QApplication *app = new QApplication(argc,argv);
    gomokugame *main = new gomokugame();
    main->show();
    return app->exec();
}
开发者ID:halftan,项目名称:GLLP,代码行数:6,代码来源:main.cpp

示例8: main

int main(int argc, char** argv) {
    QApplication app (argc, argv);
    InitWindow init_window;
    init_window.show();
    return app.exec();
}
开发者ID:Noeyfan,项目名称:smalLab,代码行数:6,代码来源:main.cpp

示例9: onQuit

void onQuit(GtkMenu *menu, gpointer data)
{
    Q_UNUSED(menu);
    QApplication *self = static_cast<QApplication *>(data);
    self->quit();
}
开发者ID:JIghtuse,项目名称:zeal,代码行数:6,代码来源:mainwindow.cpp

示例10: main

Q_DECL_EXPORT
#endif
int main(int argc, char **argv)
{
    QApplication *application;
    QDeclarativeView *view;
#ifdef HAS_BOOSTER
    application = MDeclarativeCache::qApplication(argc, argv);
    view = MDeclarativeCache::qDeclarativeView();
#else
    qWarning() << Q_FUNC_INFO << "Warning! Running without booster. This may be a bit slower.";
    QApplication stackApp(argc, argv);
    QDeclarativeView stackView;
    application = &stackApp;
    view = &stackView;
#endif

    QString path;
    QString urlstring;
    bool isFullscreen = false;
    QStringList arguments = application->arguments();
    for (int i = 0; i < arguments.count(); ++i) {
        QString parameter = arguments.at(i);
        if (parameter == "-path") {
            if (i + 1 >= arguments.count())
                qFatal("-path requires an argument");
            path = arguments.at(i + 1);
            i++;
        } else if (parameter == "-url") {
            if (i + 1 >= arguments.count())
                qFatal("-path requires an argument");
            urlstring = arguments.at(i + 1);
            i++;
        } else if (parameter == "-fullscreen") {
            isFullscreen = true;
        } else if (parameter == "-help") {
            qDebug() << "Fast QML-only application launcher";
            qDebug() << "-fullscreen   - show QML fullscreen";
            qDebug() << "-path         - path to cd to before launching -url";
            qDebug() << "-url          - file to launch (default: main.qml inside -path)";
            exit(0);
        }
    }

    if (!path.isEmpty())
        QDir::setCurrent(path);

    QUrl url;
    if (urlstring.isEmpty())
        url = QUrl::fromLocalFile("main.qml");
    else
        url = QUrl::fromUserInput(urlstring);
        

    QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
    view->setSource(url);
    view->setAttribute(Qt::WA_OpaquePaintEvent);
    view->setAttribute(Qt::WA_NoSystemBackground);
    view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    view->viewport()->setAttribute(Qt::WA_NoSystemBackground);

    if (isFullscreen)
        view->showFullScreen();
    else
        view->show();

    return application->exec();
}
开发者ID:nemomobile-graveyard,项目名称:qmllauncher,代码行数:68,代码来源:main.cpp

示例11: main

int main(int argc, char **argv)
{
#ifdef Q_WS_WIN
	// Make sure Windows doesn't load DLLs from the current working directory
	SetDllDirectoryA("");
	SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
#endif

	setlocale(LC_CTYPE, "");
	
#if defined(Q_WS_X11) && defined(AUTOTYPE)
	QApplication* app = new KeepassApplication(argc,argv);
#else
	QApplication* app = new QApplication(argc,argv);
#endif
	EventListener* eventListener = new EventListener();
	app->installEventFilter(eventListener);
	
	QApplication::setQuitOnLastWindowClosed(false);
	
	AppDir = QApplication::applicationFilePath();
	AppDir.truncate(AppDir.lastIndexOf("/"));
#if defined(Q_WS_X11)
	DataDir = AppDir+"/../share/keepassx";
	if (!QFile::exists(DataDir) && QFile::exists(AppDir+"/share"))
		DataDir = AppDir+"/share";
	const char* env = getenv("XDG_CONFIG_HOME");
	if (!env) {
		HomeDir = QDir::homePath() + "/.config";
	}
	else {
		QString qenv = QTextCodec::codecForLocale()->toUnicode(env);
		if (qenv[0] == '/')
			HomeDir = qenv;
		else
			HomeDir = QDir::homePath() + '/' + qenv;
	}
	HomeDir += "/keepassx";
#elif defined(Q_WS_MAC)
	HomeDir = QDir::homePath()+"/.keepassx";
	DataDir = AppDir+"/../Resources/keepassx";
#else //Q_WS_WIN
	HomeDir = qtWindowsConfigPath(CSIDL_APPDATA);
	if(!HomeDir.isEmpty() && QFile::exists(HomeDir))
		HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX";
	else
		HomeDir = QDir::homePath()+"/KeePassX";
	
	DataDir = AppDir+"/share";
#endif
	DataDir = QDir::cleanPath(DataDir);
	
	CmdLineArgs args;
	if ( !args.parse(QApplication::arguments()) ){
		qCritical("%s\n", CSTR( args.error() ));
		args.printHelp();
		return 1;
	}
	if (args.help()){
		args.printHelp();
		return 1;
	}

	//Load Config
	QString IniFilename;
	if(args.configLocation().isEmpty()){
		if(!QDir(HomeDir).exists()){
			QDir conf(QDir::homePath());
			if(!QDir().mkpath(HomeDir))
				qWarning("Warning: Could not create directory '%s'", CSTR(HomeDir));
		}
		IniFilename=HomeDir+"/config.ini";
	}
	else
		IniFilename=args.configLocation();

#ifdef Q_WS_X11
	{
		QString OldHomeDir = QDir::homePath()+"/.keepassx";
		if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) {
			QFile::rename(OldHomeDir+"/config", HomeDir+"/config.ini");
			if (QDir(OldHomeDir).entryList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System).count()==0)
				QDir().rmdir(OldHomeDir);
		}
	}
#else
	if (args.configLocation().isEmpty() && QFile::exists(HomeDir+"/config") && !QFile::exists(HomeDir+"/config.ini"))
		QFile::rename(HomeDir+"/config", HomeDir+"/config.ini");
#endif
	config = new KpxConfig(IniFilename);
	fileDlgHistory.load();
	
	// PlugIns
	/*
#ifdef Q_WS_X11
	if(config->integrPlugin()!=KpxConfig::NoIntegr){
		QString LibName="libkeepassx-";
		if(config->integrPlugin()==KpxConfig::KDE)
			LibName+="kde.so";
		else if(config->integrPlugin()==KpxConfig::Gnome)
//.........这里部分代码省略.........
开发者ID:Davenport-Physics,项目名称:keepassx-classic,代码行数:101,代码来源:main.cpp

示例12: 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;
    
    if (arguments.read("--CompositeViewer"))
        {
            CompositeViewerQT* viewerWindow = new CompositeViewerQT;

            unsigned int width = viewerWindow->width();
            unsigned int height = viewerWindow->height();
        
            {
                osgViewer::View* view1 = new osgViewer::View;
                view1->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow());
                view1->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
                view1->getCamera()->setViewport(new osg::Viewport(0,0,width,height/2));
                view1->setCameraManipulator(new osgGA::TrackballManipulator);
                view1->setSceneData(loadedModel.get());
            
                viewerWindow->addView(view1);
            }
        
            {
                osgViewer::View* view2 = new osgViewer::View;
                view2->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow());
                view2->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
                view2->getCamera()->setViewport(new osg::Viewport(0,height/2,width,height/2));
                view2->setCameraManipulator(new osgGA::TrackballManipulator);
                view2->setSceneData(loadedModel.get());
            
                viewerWindow->addView(view2);
            }

            viewerWindow->show();
        }
    else 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:hywei,项目名称:PatchEditor,代码行数:75,代码来源:AdapterWidget.cpp

示例13: main

int main (int argc, char** argv)
{
  arg_base::set_help_option("-h");
  arg_parse(argc, argv);
  ntk_debug_level = 1;
  cv::setBreakOnError(true);

  QApplication::setGraphicsSystem("raster");
  QApplication app (argc, argv);

  const char* fake_dir = opt::image();
  bool is_directory = opt::directory() != 0;
  if (opt::directory())
    fake_dir = opt::directory();

  ntk::RGBDProcessor* processor = 0;
  RGBDGrabber* grabber = 0;

  bool use_openni = !opt::freenect();
#ifndef USE_OPENNI
  use_openni = false;
#endif

  if (opt::image() || opt::directory())
  {
    std::string path = opt::image() ? opt::image() : opt::directory();
    FileGrabber* file_grabber = new FileGrabber(path, opt::directory() != 0);
    grabber = file_grabber;
  }
  else if (use_openni)
  {
    NiteRGBDGrabber* k_grabber = new NiteRGBDGrabber();
    if (opt::high_resolution())
      k_grabber->setHighRgbResolution(true);
    k_grabber->initialize();
    grabber = k_grabber;
  }
  else
  {
    KinectGrabber* k_grabber = new KinectGrabber();
    k_grabber->initialize();
    k_grabber->setIRMode(false);
    grabber = k_grabber;
  }

  if (use_openni)
  {
    processor = new ntk::NiteProcessor();
  }
  else
  {
    processor = new ntk::KinectProcessor();
  }

  if (opt::sync())
    grabber->setSynchronous(true);

  RGBDFrameRecorder frame_recorder (opt::dir_prefix());
  frame_recorder.setSaveOnlyRaw(false);

  ntk::RGBDCalibration* calib_data = 0;
  if (use_openni)
  {
    calib_data = grabber->calibrationData();
  }
  else if (opt::calibration_file())
  {
    calib_data = new RGBDCalibration();
    calib_data->loadFromFile(opt::calibration_file());
  }
  else if (QDir::current().exists("kinect_calibration.yml"))
  {
    {
      ntk_dbg(0) << "[WARNING] Using kinect_calibration.yml in current directory";
      ntk_dbg(0) << "[WARNING] use --calibration to specify a different file.";
    }
    calib_data = new RGBDCalibration();
    calib_data->loadFromFile("kinect_calibration.yml");
  }

  ntk_ensure(calib_data, "You must specify a calibration file (--calibration)");
  grabber->setCalibrationData(*calib_data);

  GuiController gui_controller (*grabber, *processor);
  grabber->addEventListener(&gui_controller);
  gui_controller.setFrameRecorder(frame_recorder);

  if (opt::sync())
    gui_controller.setPaused(true);

  SurfelsRGBDModeler modeler;
  modeler.setMinViewsPerSurfel(1);
  processor->setFilterFlag(RGBDProcessor::ComputeNormals, 1);
  processor->setMaxNormalAngle(90);

  ModelAcquisitionController* acq_controller = 0;
  acq_controller = new ModelAcquisitionController (gui_controller, modeler);

  RelativePoseEstimator* pose_estimator = 0;
  FeatureSetParams params ("FAST", "BRIEF64", true);
//.........这里部分代码省略.........
开发者ID:martindale,项目名称:rgbdemo,代码行数:101,代码来源:reconstructor.cpp

示例14: transitionTest

//-----------------------------------------------------------------------------
int transitionTest(ctkWorkflow* workflow, int defaultTime, QApplication& app, ctkWorkflowStep* expectedStep, ctkExampleWorkflowStepUsingSignalsAndSlots* step1, int step1Entry, int step1Exit, ctkExampleWorkflowStepUsingSignalsAndSlots* step2, int step2Entry, int step2Exit, ctkExampleWorkflowStepUsingSignalsAndSlots* step3=0, int step3Entry=0, int step3Exit=0, ctkExampleWorkflowStepUsingSignalsAndSlots* step4=0, int step4Entry=0, int step4Exit=0)
{
  QTimer::singleShot(defaultTime, &app, SLOT(quit()));
  app.exec();
  return currentStepAndNumberOfTimesEntryExitTest(workflow, expectedStep, step1, step1Entry, step1Exit, step2, step2Entry, step2Exit, step3, step3Entry, step3Exit, step4, step4Entry, step4Exit);
}
开发者ID:xplanes,项目名称:CTK,代码行数:7,代码来源:ctkWorkflowTest2.cpp

示例15: on_actionExit_triggered

void MainWindow::on_actionExit_triggered()
{
    QApplication * app;
    app->exit(0);
}
开发者ID:jiahaoyan,项目名称:keithleyRMCTRL,代码行数:5,代码来源:mainwindow.cpp


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