Qapp command line options



  • i'm searching for full list of command line options for Qt applications.
    i found special section on QApplication class reference about it, but i know, that there are another options, "platform" eg.
    does anyone help me?
    Qt version - 5.2



  • Hi Sango,

    I'm not sure if I understand you correctly, but from the documentation and from exploring several programs, it seems to me that you can create your own program specific command line options. When you look at the TextEdit example, you find this code:

    @ QString initialFile = ":/example.html";
    const QStringList args = QCoreApplication::arguments();
    if (args.count() == 2)
    initialFile = args.at(1);

    if (!load(initialFile))
        fileNew();@
    

    If you would type on the command line TextEdit /home/document.html, you would (of course) open document.html in TextEdit. So document.html is what you find at args.at(2).

    Instead of opening a file passed on as argument, you should first check what argument is passed. Something like:
    @if (args.at(1) == -h)
    showHelp();@



  • Maybe you're thinking of the built-in command line options available for all Qt apps? They're easy to find if you grep Qt's source:

    -qmljsdebugger=xxx
    -platformpluginpath xxxx
    -platform xxx
    -qwindowgeometry xxx xxxx
    -geometry xxx xxx (only on Linux)
    -plugin xxx
    -reverse
    -nograb
    -dograb
    -session xxxx
    -gdevel
    -gdebug
    -style xxx
    -stylesheet xxx
    -widgetcount
    -testability

    Note: for Qt console apps, only the first option is available. And the last 6 are only for Widget-flavored apps :-)



  • hskoglund, yes, this is what I need, thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.