summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcommandlineparser.h
Commit message (Collapse)AuthorAgeFilesLines
* QCommandLineParser: convert MessageType to enum classIvan Solovev2025-01-171-3/+3
| | | | | | | | | | | Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480. Found in Qt 6.9 API review. Pick-to: 6.9 Change-Id: I424fc1f80e36343f1aef4b05c551579ec0f04eba Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use [[noreturn]] on QCommandLineParser::showMessageAndExit()Ivan Solovev2025-01-131-1/+1
| | | | | | | | | | | | | ... instead of Q_NORETURN, as the attribute should be unconditionally available since C++11. Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480. Found in Qt 6.9 API review. Pick-to: 6.9 Change-Id: Ia008acf0777867f551c7e1cc3423f29f8ed6fbed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change QCommandLineParser::showMessageAndExit() argument orderIvan Solovev2024-12-171-1/+1
| | | | | | | | | | | | | | | | | | Looking at other similar Qt APIs, the type argument usually comes first. The typical related examples can be QMessageBox() constructor taking QIcon as a first parameter, and qFormatLogMessage() function, taking message type as a first parameter. This patch changes the order of arguments, so that MessageType enum comes as a first argument. Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480. Found in Qt 6.9 API review. Pick-to: 6.9 Change-Id: Ibbdef755a8676a2c556fe7f1c95009ad51320b98 Reviewed-by: David Faure <david.faure@kdab.com>
* Specify an underlying type for QCommandLineParser::MessageTypeIvan Solovev2024-12-171-2/+2
| | | | | | | | | | | | | | And also add a trailing comma to the last element of the enum to minimize future diffs. Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480. Found in Qt 6.9 API review. Pick-to: 6.9 Change-Id: I1a30c344967005c9abc73e59980e56626e09cd7c Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineParser: rename showParserMessage() and make it a public APIWang Zichong2024-08-231-0/+6
| | | | | | | | | This makes developer be able to use the same way to display commandline message as the ones provided by Qt internal (e.g. --help, --about). Fixes: QTBUG-127577 Change-Id: I2d3be8b5885cd1fba12978ab7b1afee4f37da0cd Reviewed-by: David Faure <david.faure@kdab.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add configure feature for QCommandLineParserLars Knoll2016-10-111-0/+2
| | | | | Change-Id: I78c1159d29e12ad03b9a3c076a40ee533958af8a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Updated license headersJani Heikkinen2016-01-151-13/+19
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QCommandLineParser: add parsing mode for options after argumentsDavid Faure2015-03-061-0/+6
| | | | | | | | | | | | | | | | | The new mode, ParseAsPositionalArguments, allows to interpret "application argument --opt" as having two positional arguments, "argument" and "--opt". This mode is useful for executables that aim to launch other executables (e.g. wrappers, debugging tools, etc.) or who support internal commands followed by options for the command. "argument" is the name of the command, and all options occurring after it can be collected and parsed by another command line parser, possibly in another executable. [ChangeLog][QtCore][QCommandLineParser] Add parsing mode for options after arguments, to allow treating them as more arguments. Change-Id: I48d5fcf90f2f59deda8422538b8ebf2680fae828 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-6/+6
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QCommandLineParser: support extremely concise option configuration in C++11Marc Mutz2014-08-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this commit to make the code in the test work: QCommandLineParser parser; parser.addOptions({ { "a", "The A option." }, { { "v", "verbose" }, "The verbose option." }, { { "i", "infile" }, "The input file.", "value" }, }); For this, QCommandLineParser needs a version of addOption that can take a list of options. That's what addOptions() is for. More importantly, the QCommandLineOption ctors mustn't be explicit. OTOH, any implicit conversion from QString or QStringList to QCommandLineOption is also undesirable. To solve this dilemma, add new QCommandLineOption ctors that just take one argument and are explicit, and make the existing ctors implicit. In order to avoid ambiguities, remove the default values of their resp. 2nd arguments. The new ctors are by intention not \since 5.4, as they are completely transparent to the user. Et voila, even better than getopt_long(3). [ChangeLog][QtCore][QCommandLineParser] Added addOptions() method. Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QCommandLineParser::showVersion(), similar to showHelp().David Faure2014-03-141-0/+1
| | | | | | Change-Id: I1782c226ee8c457a68eb9ae9948a2a6a700d7a52 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Long live QCommandLineParser!David Faure2013-08-241-0/+106
The QCommandLineParser class provides a means for handling the command line options. QCoreApplication provides the command-line arguments as a simple list of strings. QCommandLineParser provides the ability to define a set of options, parse the command-line arguments, and store which options have actually been used, as well as option values. Done-with: Laszlo Papp <lpapp@kde.org> Change-Id: Ic7bebc10b3f8d8dd06ad0f4bb897c51d566e3b7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>