本文整理汇总了C++中QApplication::argv方法的典型用法代码示例。如果您正苦于以下问题:C++ QApplication::argv方法的具体用法?C++ QApplication::argv怎么用?C++ QApplication::argv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QApplication
的用法示例。
在下文中一共展示了QApplication::argv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char **argv )
{
QApplication::setColorSpec( QApplication::CustomColor );
QApplication * a = new QApplication( argc, argv );
QString appname( "xpracman" );
QString applabel( "XpracMan" );
::XpracManDir = getenv("PRAC_DIR");
if ( !XpracManDir.length() )
XpracManDir = QMVAPPLICATIONDIR;
QString dbname = getenv( "PGDATABASE" );
QString dbaccessname = getenv( "MARVINACCESS" );
QString dbhost = getenv( "PGHOST" );
QString dbport = getenv( "PGPORT" );
int debug = 0;
int wapp = 800;
int happ = 600;
bool maximize = false;
for ( int i = 1; i < a->argc(); i++ )
{
if ( QString( a->argv()[i] ) == "--debug" )
{
debug = 1;
continue;
}
if ( QString( a->argv()[i] ) == "--maximize" )
{
maximize = true;
continue;
}
qDebug( "main: argument # %d <%s>", i, a->argv()[i] );
if ( QString( a->argv()[i] ) == "--pracdir" )
{
++i;
XpracManDir = QString( a->argv()[i] );
continue;
}
if ( QString( a->argv()[i] ) == "--database" )
{
++i;
dbname = QString( a->argv()[i] );
continue;
}
if ( QString( a->argv()[i] ) == "--database-host" )
{
++i;
dbhost = QString( a->argv()[i] );
continue;
}
if ( QString( a->argv()[i] ) == "--database-port" )
{
++i;
dbport = QString( a->argv()[i] );
continue;
}
if ( QString( a->argv()[i] ) == "--accessdb" )
{
++i;
dbaccessname = QString( a->argv()[i] );
continue;
}
if ( QString( a->argv()[i] ) == "--applabel" )
{
++i;
applabel = QString( a->argv()[i] );
continue;
}
QMessageBox::critical( 0, QString( "%1: Illegal argument:fatal" ).arg( appname ),
QString( "An unknown argument was detected.\n\n %1\n\n"
"This application will now exit." )
.arg( QString( a->argv()[i] ) ) );
exit(1);
}
// Start a splash screen asap
QProgressDialog splash( QString("Starting %1...").arg(applabel), "Abort", 100, 0, "progress", TRUE );
splash.setProgress( 10 );
qApp->processEvents();
if ( splash.wasCancelled() )
exit(1);
if ( !debug )
qInstallMsgHandler( messageHandler );
// ------------------------------------------------------------
// Settle on an access database name
// ------------------------------------------------------------
if ( dbaccessname.isNull() || dbaccessname.length() < 1 )
if ( dbname.isNull() || dbname.length() < 1 )
dbaccessname = QString("marvin_access");
else
dbaccessname = dbname;
// ------------------------------------------------------------
//.........这里部分代码省略.........