summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcommandlineparser.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2024-12-16 11:59:46 +0100
committerIvan Solovev <ivan.solovev@qt.io>2024-12-17 14:36:40 +0100
commit56114f4d1ed6ec26ff59a596caf09f5b4e0f5d68 (patch)
treeaa9352efa7f26091fe99b69173e1a575033be5c7 /src/corelib/tools/qcommandlineparser.cpp
parent6692beace9bb5f461d71935e500e1c6ccfa97fd1 (diff)
Change QCommandLineParser::showMessageAndExit() argument order
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>
Diffstat (limited to 'src/corelib/tools/qcommandlineparser.cpp')
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index 0f421d57438..45831d093d7 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -562,7 +562,7 @@ static inline bool displayMessageBox()
\sa addVersionOption(), showHelp(), showVersion(), QCommandLineParser::MessageType
*/
-Q_NORETURN void QCommandLineParser::showMessageAndExit(const QString &message, MessageType type, int exitCode)
+Q_NORETURN void QCommandLineParser::showMessageAndExit(MessageType type, const QString &message, int exitCode)
{
#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
if (displayMessageBox()) {
@@ -601,8 +601,9 @@ Q_NORETURN void QCommandLineParser::showMessageAndExit(const QString &message, M
void QCommandLineParser::process(const QStringList &arguments)
{
if (!d->parse(arguments)) {
- showMessageAndExit(QCoreApplication::applicationName() + ": "_L1 + errorText() + u'\n',
- ErrorMessage, EXIT_FAILURE);
+ showMessageAndExit(ErrorMessage,
+ QCoreApplication::applicationName() + ": "_L1 + errorText() + u'\n',
+ EXIT_FAILURE);
}
if (d->builtinVersionOption && isSet(QStringLiteral("version")))
@@ -1035,9 +1036,10 @@ QStringList QCommandLineParser::unknownOptionNames() const
*/
Q_NORETURN void QCommandLineParser::showVersion()
{
- showMessageAndExit(QCoreApplication::applicationName() + u' '
+ showMessageAndExit(InformationMessage,
+ QCoreApplication::applicationName() + u' '
+ QCoreApplication::applicationVersion() + u'\n',
- InformationMessage, EXIT_SUCCESS);
+ EXIT_SUCCESS);
}
/*!
@@ -1058,8 +1060,9 @@ Q_NORETURN void QCommandLineParser::showHelp(int exitCode)
Q_NORETURN void QCommandLineParserPrivate::showHelp(int exitCode, bool includeQtOptions)
{
- QCommandLineParser::showMessageAndExit(helpText(includeQtOptions),
- QCommandLineParser::InformationMessage, exitCode);
+ QCommandLineParser::showMessageAndExit(QCommandLineParser::InformationMessage,
+ helpText(includeQtOptions),
+ exitCode);
}
/*!