Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_tools_qcommandlineoption.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 David Faure <faure@kde.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QCommandLineOption>
5#include <QCommandLineParser>
6
7int main()
8{
9
11QCommandLineOption verboseOption("verbose", "Verbose mode. Prints out more information.");
12QCommandLineOption outputOption(QStringList() << "o" << "output", "Write generated data into <file>.", "file");
14
17parser.addOption({"verbose", "Verbose mode. Prints out more information."});
19
22parser.addOption({{"o", "output"}, "Write generated data into <file>.", "file"});
24
25}
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
The QCommandLineParser class provides a means for handling the command line options.
bool addOption(const QCommandLineOption &commandLineOption)
Adds the option option to look for while parsing.
QList< QString > QStringList
Constructs a string list that contains the given string, str.