4#include <QCoreApplication>
5#include <QCommandLineParser>
6#include <QStandardPaths>
14#if QT_CONFIG(settings)
15# include <private/qlibraryinfo_p.h>
16# include <qmakelibraryinfo.h>
17# include <propertyprinter.h>
64#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
65 {
"DataLocation", QStandardPaths::DataLocation,
true },
92 std::sort(typelist.begin(), typelist.end());
119 if (positionalArgumentCount != 1)
203 QStringLiteral(
"List of Qt properties. Can be used standalone or with the "
204 "--query-format and --qtconf options."));
208 QStringLiteral(
"Output format for --qt-query.\nSupported formats: qmake (default), json"),
214 QStringLiteral(
"Path to qt.conf file that will be used to override the queried Qt properties."),
222#if QT_CONFIG(settings)
223 if (parser.
isSet(qtconf)) {
224 qtconfManualPath = parser.
value(qtconf);
225 QLibraryInfoPrivate::qtconfManualPath = &qtconfManualPath;
230 if (parser.
isSet(qtversion)) {
235 if (parser.
isSet(installprefix)) {
240 if (parser.
isSet(bindir)) {
245 if (parser.
isSet(plugindir)) {
252 results << typesList.join(
'\n');
256#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1300 && Q_CC_GNU < 1400
271 if (parser.
isSet(writablePath)) {
277 if (parser.
isSet(findExe)) {
283 if (parser.
isSet(locateDir)) {
290 if (parser.
isSet(locateFile)) {
297 if (parser.
isSet(locateDirs)) {
304 if (parser.
isSet(locateFiles)) {
312#if !QT_CONFIG(settings)
314 error(
QStringLiteral(
"--qt-query, --qtconf and --query-format options are not supported. The 'settings' feature is missing."));
323 PropertyPrinter printer;
324 if (parser.
isSet(queryformat)) {
326 if (formatValue ==
"json") {
327 printer = jsonPropertyPrinter;
328 }
else if (formatValue !=
"qmake") {
337 return prop.queryProperty(optionProperties, printer);
339 return prop.queryProperty(optionProperties);
340 }
else if (parser.
isSet(queryformat)) {
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
void setDefaultValue(const QString &defaultValue)
Sets the default value used for this option to defaultValue.
void setFlags(Flags aflags)
Set the set of flags that affect this command-line option to flags.
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.
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.
QStringList positionalArguments() const
Returns a list of positional arguments.
void setSingleDashWordOptionMode(SingleDashWordOptionMode parsingMode)
Sets the parsing mode to singleDashWordOptionMode.
void setApplicationDescription(const QString &description)
Sets the application description shown by helpText().
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.
bool isSet(const QString &name) const
Checks whether the option name was passed to the application.
void process(const QStringList &arguments)
Processes the command line arguments.
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.
static void setApplicationVersion(const QString &version)
static QString path(LibraryPath p)
qsizetype size() const noexcept
bool isEmpty() const noexcept
static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options=LocateFile)
[0]
static void setTestModeEnabled(bool testMode)
static QStringList standardLocations(StandardLocation type)
static QString writableLocation(StandardLocation type)
static QString displayName(StandardLocation type)
static QString findExecutable(const QString &executableName, const QStringList &paths=QStringList())
static QString locate(StandardLocation type, const QString &fileName, LocateOptions options=LocateFile)
StandardLocation
This enum describes the different locations that can be queried using methods such as QStandardPaths:...
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QStandardPaths::StandardLocation enumvalue
QString mapName(const QString &s) const
struct wl_display * display
#define QT_WARNING_DISABLE_GCC(text)
DBusConnection const char DBusError * error
GLsizei GLenum GLenum * types
GLsizei const GLuint * paths
GLuint GLsizei const GLchar * message
GLsizei const GLchar *const * path
#define qPrintable(string)
#define QStringLiteral(str)
static QStringList types()
static const StringEnum & parseLocationOrError(const QString &locationString)
static const StringEnum lookupTableData[]
static QString searchStringOrError(QCommandLineParser *parser)
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
QApplication app(argc, argv)
[0]
\inmodule QtCore \reentrant