Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qcommandlineparser.cpp
Go to the documentation of this file.
1// Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
2// Copyright (C) 2013 David Faure <faure@kde.org>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
6
7#include <qcoreapplication.h>
8#include <private/qcoreapplication_p.h>
9#include <qhash.h>
10#include <qvarlengtharray.h>
11#include <qlist.h>
12#include <qdebug.h>
13#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
14# include <qt_windows.h>
15#endif
16#include <stdio.h>
17#include <stdlib.h>
18
20
21using namespace Qt::StringLiterals;
22
23extern void Q_CORE_EXPORT qt_call_post_routines();
24
26
28{
29public:
31 : singleDashWordOptionMode(QCommandLineParser::ParseAsCompactedShortOptions),
35 needsParsing(true)
36 { }
37
38 bool parse(const QStringList &args);
39 void checkParsed(const char *method);
40 QStringList aliases(const QString &name) const;
41 QString helpText(bool includeQtOptions) const;
42 bool registerFoundOption(const QString &optionName);
43 bool parseOptionValue(const QString &optionName, const QString &argument,
44 QStringList::const_iterator *argumentIterator,
45 QStringList::const_iterator argsEnd);
46 Q_NORETURN void showHelp(int exitCode, bool includeQtOptions);
47
50
53
56
59
62
65
68
71
74 {
78 };
80
83
86
89
92
95};
97
99{
101 if (it == nameHash.cend()) {
102 qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
103 return QStringList();
104 }
105 return commandLineOptionList.at(*it).names();
106}
107
241{
242}
243
248{
249 delete d;
250}
251
283{
284 d->singleDashWordOptionMode = singleDashWordOptionMode;
285}
286
318{
320}
321
331{
332 const QStringList optionNames = option.names();
333
334 if (!optionNames.isEmpty()) {
335 for (const QString &name : optionNames) {
336 if (d->nameHash.contains(name)) {
337 qWarning() << "QCommandLineParser: already having an option named" << name;
338 return false;
339 }
340 }
341
343
345 for (const QString &name : optionNames)
347
348 return true;
349 }
350
351 return false;
352}
353
366{
367 // should be optimized (but it's no worse than what was possible before)
368 bool result = true;
369 for (QList<QCommandLineOption>::const_iterator it = options.begin(), end = options.end(); it != end; ++it)
370 result &= addOption(*it);
371 return result;
372}
373
384{
385 QCommandLineOption opt(QStringList() << QStringLiteral("v") << QStringLiteral("version"), tr("Displays version information."));
386 addOption(opt);
387 d->builtinVersionOption = true;
388 return opt;
389}
390
410{
412#ifdef Q_OS_WIN
413 << QStringLiteral("?")
414#endif
415 << QStringLiteral("h")
416 << QStringLiteral("help"), tr("Displays help on commandline options."));
417 addOption(opt);
418 QCommandLineOption optHelpAll(QStringLiteral("help-all"),
419 tr("Displays help, including generic Qt options."));
420 addOption(optHelpAll);
421 d->builtinHelpOption = true;
422 return opt;
423}
424
429{
430 d->description = description;
431}
432
437{
438 return d->description;
439}
440
453void QCommandLineParser::addPositionalArgument(const QString &name, const QString &description, const QString &syntax)
454{
456 arg.name = name;
457 arg.description = description;
458 arg.syntax = syntax.isEmpty() ? name : syntax;
460}
461
474{
476}
477
498{
499 return d->parse(arguments);
500}
501
507{
508 if (!d->errorText.isEmpty())
509 return d->errorText;
510 if (d->unknownOptionNames.size() == 1)
511 return tr("Unknown option '%1'.").arg(d->unknownOptionNames.first());
512 if (d->unknownOptionNames.size() > 1)
513 return tr("Unknown options: %1.").arg(d->unknownOptionNames.join(QStringLiteral(", ")));
514 return QString();
515}
516
518
519#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
520// Return whether to use a message box. Use handles if a console can be obtained
521// or we are run with redirected handles (for example, by QProcess).
522static inline bool displayMessageBox()
523{
524 if (GetConsoleWindow()
525 || qEnvironmentVariableIsSet("QT_COMMAND_LINE_PARSER_NO_GUI_MESSAGE_BOXES"))
526 return false;
527 STARTUPINFO startupInfo;
528 startupInfo.cb = sizeof(STARTUPINFO);
529 GetStartupInfo(&startupInfo);
530 return !(startupInfo.dwFlags & STARTF_USESTDHANDLES);
531}
532#endif // Q_OS_WIN && !QT_BOOTSTRAPPED
533
535{
536#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
537 if (displayMessageBox()) {
538 const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND
539 | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR);
542 title = QCoreApplication::instance()->property("applicationDisplayName").toString();
543 if (title.isEmpty())
545 MessageBoxW(0, reinterpret_cast<const wchar_t *>(message.utf16()),
546 reinterpret_cast<const wchar_t *>(title.utf16()), flags);
547 return;
548 }
549#endif // Q_OS_WIN && !QT_BOOTSTRAPPED
550 fputs(qPrintable(message), type == UsageMessage ? stdout : stderr);
551}
552
568{
569 if (!d->parse(arguments)) {
572 ::exit(EXIT_FAILURE);
573 }
574
575 if (d->builtinVersionOption && isSet(QStringLiteral("version")))
576 showVersion();
577
578 if (d->builtinHelpOption && isSet(QStringLiteral("help")))
579 d->showHelp(EXIT_SUCCESS, false);
580
581 if (d->builtinHelpOption && isSet(QStringLiteral("help-all")))
582 d->showHelp(EXIT_SUCCESS, true);
583}
584
591{
592 // QCoreApplication::arguments() is static, but the app instance must exist so we require it as parameter
593 Q_UNUSED(app);
595}
596
598{
599 if (needsParsing)
600 qWarning("QCommandLineParser: call process() or parse() before %s", method);
601}
602
609{
610 if (nameHash.contains(optionName)) {
611 optionNames.append(optionName);
612 return true;
613 } else {
614 unknownOptionNames.append(optionName);
615 return false;
616 }
617}
618
632 QStringList::const_iterator *argumentIterator, QStringList::const_iterator argsEnd)
633{
634 const QLatin1Char assignChar('=');
635 const NameHash_t::const_iterator nameHashIt = nameHash.constFind(optionName);
636 if (nameHashIt != nameHash.constEnd()) {
637 const qsizetype assignPos = argument.indexOf(assignChar);
638 const NameHash_t::mapped_type optionOffset = *nameHashIt;
639 const bool withValue = !commandLineOptionList.at(optionOffset).valueName().isEmpty();
640 if (withValue) {
641 if (assignPos == -1) {
642 ++(*argumentIterator);
643 if (*argumentIterator == argsEnd) {
644 errorText = QCommandLineParser::tr("Missing value after '%1'.").arg(argument);
645 return false;
646 }
647 optionValuesHash[optionOffset].append(*(*argumentIterator));
648 } else {
649 optionValuesHash[optionOffset].append(argument.mid(assignPos + 1));
650 }
651 } else {
652 if (assignPos != -1) {
653 errorText = QCommandLineParser::tr("Unexpected value after '%1'.").arg(argument.left(assignPos));
654 return false;
655 }
656 }
657 }
658 return true;
659}
660
673{
674 needsParsing = false;
675 bool error = false;
676
677 const QString doubleDashString(QStringLiteral("--"));
678 const QLatin1Char dashChar('-');
679 const QLatin1Char assignChar('=');
680
681 bool forcePositional = false;
684 optionNames.clear();
685 unknownOptionNames.clear();
687
688 if (args.isEmpty()) {
689 qWarning("QCommandLineParser: argument list cannot be empty, it should contain at least the executable name");
690 return false;
691 }
692
693 QStringList::const_iterator argumentIterator = args.begin();
694 ++argumentIterator; // skip executable name
695
696 for (; argumentIterator != args.end() ; ++argumentIterator) {
697 QString argument = *argumentIterator;
698
699 if (forcePositional) {
701 } else if (argument.startsWith(doubleDashString)) {
702 if (argument.size() > 2) {
703 QString optionName = argument.mid(2).section(assignChar, 0, 0);
704 if (registerFoundOption(optionName)) {
705 if (!parseOptionValue(optionName, argument, &argumentIterator, args.end()))
706 error = true;
707 } else {
708 error = true;
709 }
710 } else {
711 forcePositional = true;
712 }
713 } else if (argument.startsWith(dashChar)) {
714 if (argument.size() == 1) { // single dash ("stdin")
716 continue;
717 }
718 switch (singleDashWordOptionMode) {
720 {
721 QString optionName;
722 bool valueFound = false;
723 for (int pos = 1 ; pos < argument.size(); ++pos) {
724 optionName = argument.mid(pos, 1);
725 if (!registerFoundOption(optionName)) {
726 error = true;
727 } else {
728 const NameHash_t::const_iterator nameHashIt = nameHash.constFind(optionName);
729 Q_ASSERT(nameHashIt != nameHash.constEnd()); // checked by registerFoundOption
730 const NameHash_t::mapped_type optionOffset = *nameHashIt;
731 const bool withValue = !commandLineOptionList.at(optionOffset).valueName().isEmpty();
732 if (withValue) {
733 if (pos + 1 < argument.size()) {
734 if (argument.at(pos + 1) == assignChar)
735 ++pos;
736 optionValuesHash[optionOffset].append(argument.mid(pos + 1));
737 valueFound = true;
738 }
739 break;
740 }
741 if (pos + 1 < argument.size() && argument.at(pos + 1) == assignChar)
742 break;
743 }
744 }
745 if (!valueFound && !parseOptionValue(optionName, argument, &argumentIterator, args.end()))
746 error = true;
747 break;
748 }
750 {
751 if (argument.size() > 2) {
752 const QString possibleShortOptionStyleName = argument.mid(1, 1);
753 const auto shortOptionIt = nameHash.constFind(possibleShortOptionStyleName);
754 if (shortOptionIt != nameHash.constEnd()) {
755 const auto &arg = commandLineOptionList.at(*shortOptionIt);
757 registerFoundOption(possibleShortOptionStyleName);
758 optionValuesHash[*shortOptionIt].append(argument.mid(2));
759 break;
760 }
761 }
762 }
763 const QString optionName = argument.mid(1).section(assignChar, 0, 0);
764 if (registerFoundOption(optionName)) {
765 if (!parseOptionValue(optionName, argument, &argumentIterator, args.end()))
766 error = true;
767 } else {
768 error = true;
769 }
770 break;
771 }
772 }
773 } else {
776 forcePositional = true;
777 }
778 if (argumentIterator == args.end())
779 break;
780 }
781 return !error;
782}
783
799{
800 d->checkParsed("isSet");
801 if (d->optionNames.contains(name))
802 return true;
803 const QStringList aliases = d->aliases(name);
804 for (const QString &optionName : std::as_const(d->optionNames)) {
805 if (aliases.contains(optionName))
806 return true;
807 }
808 return false;
809}
810
830{
831 d->checkParsed("value");
832 const QStringList valueList = values(optionName);
833
834 if (!valueList.isEmpty())
835 return valueList.last();
836
837 return QString();
838}
839
859{
860 d->checkParsed("values");
861 auto it = d->nameHash.constFind(optionName);
862 if (it != d->nameHash.cend()) {
863 const qsizetype optionOffset = *it;
864 QStringList values = d->optionValuesHash.value(optionOffset);
865 if (values.isEmpty())
866 values = d->commandLineOptionList.at(optionOffset).defaultValues();
867 return values;
868 }
869
870 qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
871 return QStringList();
872}
873
886{
887 // option.names() might be empty if the constructor failed
888 const auto names = option.names();
889 return !names.isEmpty() && isSet(names.first());
890}
891
906{
907 return value(option.names().constFirst());
908}
909
924{
925 return values(option.names().constFirst());
926}
927
936{
937 d->checkParsed("positionalArguments");
938 return d->positionalArgumentList;
939}
940
958{
959 d->checkParsed("optionNames");
960 return d->optionNames;
961}
962
978{
979 d->checkParsed("unknownOptionNames");
980 return d->unknownOptionNames;
981}
982
994{
999 ::exit(EXIT_SUCCESS);
1000}
1001
1014{
1015 d->showHelp(exitCode, false);
1016}
1017
1018Q_NORETURN void QCommandLineParserPrivate::showHelp(int exitCode, bool includeQtOptions)
1019{
1020 showParserMessage(helpText(includeQtOptions), UsageMessage);
1022 ::exit(exitCode);
1023}
1024
1031{
1032 return d->helpText(false);
1033}
1034
1035static QString wrapText(const QString &names, int optionNameMaxWidth, const QString &description)
1036{
1037 const auto nl = u'\n';
1038 const auto indentation = " "_L1;
1039
1040 // In case the list of option names is very long, wrap it as well
1041 int nameIndex = 0;
1042 auto nextNameSection = [&]() {
1043 QString section = names.mid(nameIndex, optionNameMaxWidth);
1044 nameIndex += section.size();
1045 return section;
1046 };
1047
1048 QString text;
1049 qsizetype lineStart = 0;
1050 qsizetype lastBreakable = -1;
1051 const int max = 79 - (indentation.size() + optionNameMaxWidth + 1);
1052 int x = 0;
1053 const qsizetype len = description.size();
1054
1055 for (qsizetype i = 0; i < len; ++i) {
1056 ++x;
1057 const QChar c = description.at(i);
1058 if (c.isSpace())
1059 lastBreakable = i;
1060
1061 qsizetype breakAt = -1;
1062 qsizetype nextLineStart = -1;
1063 if (x > max && lastBreakable != -1) {
1064 // time to break and we know where
1065 breakAt = lastBreakable;
1066 nextLineStart = lastBreakable + 1;
1067 } else if ((x > max - 1 && lastBreakable == -1) || i == len - 1) {
1068 // time to break but found nowhere [-> break here], or end of last line
1069 breakAt = i + 1;
1070 nextLineStart = breakAt;
1071 } else if (c == nl) {
1072 // forced break
1073 breakAt = i;
1074 nextLineStart = i + 1;
1075 }
1076
1077 if (breakAt != -1) {
1078 const qsizetype numChars = breakAt - lineStart;
1079 //qDebug() << "breakAt=" << description.at(breakAt) << "breakAtSpace=" << breakAtSpace << lineStart << "to" << breakAt << description.mid(lineStart, numChars);
1080 text += indentation + nextNameSection().leftJustified(optionNameMaxWidth) + u' ';
1081 text += QStringView{description}.mid(lineStart, numChars) + nl;
1082 x = 0;
1083 lastBreakable = -1;
1084 lineStart = nextLineStart;
1085 if (lineStart < len && description.at(lineStart).isSpace())
1086 ++lineStart; // don't start a line with a space
1087 i = lineStart;
1088 }
1089 }
1090
1091 while (nameIndex < names.size()) {
1092 text += indentation + nextNameSection() + nl;
1093 }
1094
1095 return text;
1096}
1097
1099{
1100 const QLatin1Char nl('\n');
1101 QString text;
1102 QString usage;
1103 // executable name
1104 usage += qApp ? QCoreApplication::arguments().constFirst() : QStringLiteral("<executable_name>");
1106 if (includeQtOptions && qApp)
1107 qApp->d_func()->addQtOptions(&options);
1108 if (!options.isEmpty())
1109 usage += u' ' + QCommandLineParser::tr("[options]");
1111 usage += u' ' + arg.syntax;
1112 text += QCommandLineParser::tr("Usage: %1").arg(usage) + nl;
1113 if (!description.isEmpty())
1114 text += description + nl;
1115 text += nl;
1116 if (!options.isEmpty())
1117 text += QCommandLineParser::tr("Options:") + nl;
1118 QStringList optionNameList;
1119 optionNameList.reserve(options.size());
1120 qsizetype longestOptionNameString = 0;
1121 for (const QCommandLineOption &option : std::as_const(options)) {
1123 continue;
1124 const QStringList optionNames = option.names();
1125 QString optionNamesString;
1126 for (const QString &optionName : optionNames) {
1127 const int numDashes = optionName.size() == 1 ? 1 : 2;
1128 optionNamesString += QLatin1StringView("--", numDashes) + optionName + ", "_L1;
1129 }
1130 if (!optionNames.isEmpty())
1131 optionNamesString.chop(2); // remove trailing ", "
1132 const auto valueName = option.valueName();
1133 if (!valueName.isEmpty())
1134 optionNamesString += " <"_L1 + valueName + u'>';
1135 optionNameList.append(optionNamesString);
1136 longestOptionNameString = qMax(longestOptionNameString, optionNamesString.size());
1137 }
1138 ++longestOptionNameString;
1139 const int optionNameMaxWidth = qMin(50, int(longestOptionNameString));
1140 auto optionNameIterator = optionNameList.cbegin();
1141 for (const QCommandLineOption &option : std::as_const(options)) {
1143 continue;
1144 text += wrapText(*optionNameIterator, optionNameMaxWidth, option.description());
1145 ++optionNameIterator;
1146 }
1147 if (!positionalArgumentDefinitions.isEmpty()) {
1148 if (!options.isEmpty())
1149 text += nl;
1150 text += QCommandLineParser::tr("Arguments:") + nl;
1152 text += wrapText(arg.name, optionNameMaxWidth, arg.description);
1153 }
1154 return text;
1155}
1156
\inmodule QtCore
Definition qchar.h:48
constexpr bool isSpace() const noexcept
Returns true if the character is a separator character (Separator_* categories or certain code points...
Definition qchar.h:466
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
QString valueName() const
Returns the name of the expected value.
QStringList defaultValues() const
Returns the default values set for this option.
QStringList names() const
Returns the names set for this option.
QStringList aliases(const QString &name) const
bool parseOptionValue(const QString &optionName, const QString &argument, QStringList::const_iterator *argumentIterator, QStringList::const_iterator argsEnd)
Parse the value for a given option, if it was defined to expect one.
bool registerFoundOption(const QString &optionName)
NameHash_t nameHash
Hash mapping option names to their offsets in commandLineOptionList and optionArgumentList.
bool builtinVersionOption
Whether addVersionOption was called.
QHash< qsizetype, QStringList > optionValuesHash
Option values found (only for options with a value)
QStringList optionNames
Names of options found on the command line.
QString helpText(bool includeQtOptions) const
QString description
Application description.
bool needsParsing
True if parse() needs to be called.
void checkParsed(const char *method)
QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode
The parsing mode for "-abc".
bool parse(const QStringList &args)
bool builtinHelpOption
Whether addHelpOption was called.
QStringList unknownOptionNames
Names of options which were unknown.
QCommandLineParser::OptionsAfterPositionalArgumentsMode optionsAfterPositionalArgumentsMode
How to parse "arg -option".
QStringList positionalArgumentList
Arguments which did not belong to any option.
QList< PositionalArgumentDefinition > positionalArgumentDefinitions
Q_NORETURN void showHelp(int exitCode, bool includeQtOptions)
QList< QCommandLineOption > commandLineOptionList
The command line options used for parsing.
QString errorText
Error text set when parse() returns false.
The QCommandLineParser class provides a means for handling the command line options.
QString value(const QString &name) const
Returns the option value found for the given option name optionName, or an empty string if not found.
bool parse(const QStringList &arguments)
Parses the command line arguments.
void addPositionalArgument(const QString &name, const QString &description, const QString &syntax=QString())
Defines an additional argument to the application, for the benefit of the help text.
QString applicationDescription() const
Returns the application description set in setApplicationDescription().
QStringList positionalArguments() const
Returns a list of positional arguments.
QStringList unknownOptionNames() const
Returns a list of unknown option names.
void setSingleDashWordOptionMode(SingleDashWordOptionMode parsingMode)
Sets the parsing mode to singleDashWordOptionMode.
Q_NORETURN void showVersion()
Displays the version information from QCoreApplication::applicationVersion(), and exits the applicati...
QStringList values(const QString &name) const
Returns a list of option values found for the given option name optionName, or an empty list if not f...
void setApplicationDescription(const QString &description)
Sets the application description shown by helpText().
bool addOptions(const QList< QCommandLineOption > &options)
bool addOption(const QCommandLineOption &commandLineOption)
Adds the option option to look for while parsing.
Q_NORETURN void showHelp(int exitCode=0)
Displays the help information, and exits the application.
QString errorText() const
Returns a translated error text for the user.
SingleDashWordOptionMode
This enum describes the way the parser interprets command-line options that use a single dash followe...
bool isSet(const QString &name) const
Checks whether the option name was passed to the application.
~QCommandLineParser()
Destroys the command line parser object.
QCommandLineParser()
Constructs a command line parser object.
QString helpText() const
Returns a string containing the complete help information.
QStringList optionNames() const
Returns a list of option names that were found.
void process(const QStringList &arguments)
Processes the command line arguments.
void clearPositionalArguments()
Clears the definitions of additional arguments from the help text.
OptionsAfterPositionalArgumentsMode
This enum describes the way the parser interprets options that occur after positional arguments.
void setOptionsAfterPositionalArgumentsMode(OptionsAfterPositionalArgumentsMode mode)
Sets the parsing mode to parsingMode.
QCommandLineOption addVersionOption()
Adds the {-v} / {–version} option, which displays the version string of the application.
QCommandLineOption addHelpOption()
Adds help options to the command-line parser.
\inmodule QtCore
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
QString applicationVersion
the version of this application
static QStringList arguments()
QString applicationName
the name of this application
\inmodule QtCore
Definition qhash.h:818
const_iterator constFind(const Key &key) const noexcept
Definition qhash.h:1279
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
Definition qhash.h:1209
qsizetype mapped_type
Typedef for T.
Definition qhash.h:829
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
Definition qhash.h:991
T value(const Key &key) const noexcept
Definition qhash.h:1044
friend class const_iterator
Definition qhash.h:1172
const_iterator cend() const noexcept
Definition qhash.h:1208
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
Definition qhash.h:949
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition qhash.h:1283
Definition qlist.h:74
qsizetype size() const noexcept
Definition qlist.h:386
bool isEmpty() const noexcept
Definition qlist.h:390
iterator end()
Definition qlist.h:609
const_reference at(qsizetype i) const noexcept
Definition qlist.h:429
iterator begin()
Definition qlist.h:608
void append(parameter_type t)
Definition qlist.h:441
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4187
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:76
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
void chop(qsizetype n)
Removes n characters from the end of the string.
Definition qstring.cpp:6180
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
Definition qstring.cpp:6737
void clear()
Clears the contents of the string and makes it null.
Definition qstring.h:1107
qsizetype size() const
Returns the number of characters in this string.
Definition qstring.h:182
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8606
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
Definition qstring.cpp:5204
QString leftJustified(qsizetype width, QChar fill=u' ', bool trunc=false) const
Returns a string of size width that contains this string padded by the fill character.
Definition qstring.cpp:6764
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
Definition qstring.h:1079
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QString text
QSet< QString >::iterator it
QList< QVariant > arguments
QStyleOptionButton opt
Combined button and popup list for selecting options.
QHash< QString, qsizetype > NameHash_t
static QString wrapText(const QString &names, int optionNameMaxWidth, const QString &description)
static void showParserMessage(const QString &message, MessageType type)
void Q_CORE_EXPORT qt_call_post_routines()
#define Q_NORETURN
void Q_CORE_EXPORT qt_call_post_routines()
#define qApp
DBusConnection const char DBusError * error
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
static void showHelp()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qWarning
Definition qlogging.h:162
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLenum GLsizei GLsizei GLint * values
[15]
GLint GLint GLint GLint GLint x
[0]
GLuint GLuint end
GLenum type
GLbitfield flags
GLuint GLsizei const GLchar * message
GLenum GLuint GLintptr offset
GLuint name
const GLubyte * c
GLuint GLuint * names
GLenum GLsizei len
GLuint64EXT * result
[6]
GLuint GLenum option
GLsizeiptr const void GLenum usage
Definition qopenglext.h:543
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int(*) void arg)
#define qPrintable(string)
Definition qstring.h:1391
#define qUtf16Printable(string)
Definition qstring.h:1403
#define QStringLiteral(str)
#define tr(X)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
#define Q_UNUSED(x)
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:145
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:163
ptrdiff_t qsizetype
Definition qtypes.h:70
QString title
[35]
QApplication app(argc, argv)
[0]
QDBusArgument argument
QJSValueList args
\inmodule QtCore \reentrant
Definition qchar.h:17