diff options
author | John Fultz <jfultz@wolfram.com> | 2017-08-02 00:21:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-02 00:21:40 -0500 |
commit | 6684280feec74fa4c58066cf8e667b5f19a717c7 (patch) | |
tree | 6fa1e702d41eaac6e985f4e6adc1e0574f0574e5 /quackleio/froggetopt.cpp | |
parent | 9593f48793d6a11617de47a96c282f9ddb153cd5 (diff) | |
parent | a91130890c24612fd4c1fba0fabce5723ffe78d4 (diff) |
Merge pull request #37 from gokceneraslan/qt55
Port quackle to Qt 5.5
Diffstat (limited to 'quackleio/froggetopt.cpp')
-rw-r--r-- | quackleio/froggetopt.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/quackleio/froggetopt.cpp b/quackleio/froggetopt.cpp index 68f20fe..9131ecc 100644 --- a/quackleio/froggetopt.cpp +++ b/quackleio/froggetopt.cpp @@ -130,7 +130,7 @@ GetOpt::GetOpt() if ( !QCoreApplication::instance() ) qFatal( "GetOpt: requires a QApplication instance to be constructed first" ); - init( QCoreApplication::instance()->argc(), QCoreApplication::instance()->argv(), 1 ); + init( QCoreApplication::instance()->arguments(), 1 ); } /** @@ -141,7 +141,7 @@ GetOpt::GetOpt( int offset ) if ( !QCoreApplication::instance() ) qFatal( "GetOpt: requires a QApplication instance to be constructed first" ); - init( QCoreApplication::instance()->argc(), QCoreApplication::instance()->argv(), offset ); + init( QCoreApplication::instance()->arguments(), offset ); } /** @@ -178,6 +178,18 @@ GetOpt::GetOpt( int argc, char *argv[] ) init( 0, 0 ); } +void GetOpt::init( const QStringList &argv, int offset ) +{ + numReqArgs = numOptArgs = 0; + currArg = 1; // appname is not part of the arguments + + // application name + aname = QFileInfo( argv[0] ).fileName(); + + for ( int i = offset; i < argv.size(); ++i ) + args.append( argv[i] ); +} + /** \internal */ |