38 const auto uiFileSize = uiFile.
size();
43 if (uiFileSize > canonicalPathSize
44 && uiFile.
at(canonicalPathSize) == u
'/'
76 outputOption.setValueName(u
"file"_s);
80 noAutoConnectionOption.
setDescription(u
"Do not generate a call to QObject::connectSlotsByName()."_s);
88 noImplicitIncludesOption.
setDescription(u
"Disable generation of #include-directives."_s);
89 parser.
addOption(noImplicitIncludesOption);
92 postfixOption.
setDescription(u
"Postfix to add to all generated classnames."_s);
98 u
"Disable wrapping the definition of the generated class in QT_{BEGIN,END}_NAMESPACE."_s);
103 translateOption.setValueName(u
"function"_s);
107 includeOption.
setDescription(u
"Add #include <include-file> to <file>."_s);
108 includeOption.setValueName(u
"include-file"_s);
113 generatorOption.setValueName(u
"python|cpp"_s);
118 connectionsOption.setValueName(u
"pmf|string"_s);
122 idBasedOption.
setDescription(u
"Use id based function for i18n"_s);
126 fromImportsOption.
setDescription(u
"Python: generate imports relative to '.'"_s);
130 absoluteImportsOption.
setDescription(u
"Python: generate absolute imports"_s);
135 rcPrefixOption.
setDescription(uR
"(Python: Generate "rc_file" instead of "file_rc" import)"_s);
144 pythonPathOption.
setDescription(u
"Python paths for --absolute-imports."_s);
162 if (parser.
isSet(connectionsOption)) {
163 const auto value = parser.
value(connectionsOption);
164 if (
value ==
"pmf"_L1)
166 else if (
value ==
"string"_L1)
173 if (parser.
isSet(generatorOption)) {
174 if (parser.
value(generatorOption).
compare(
"python"_L1) == 0)
179 if (parser.
isSet(fromImportsOption))
181 else if (parser.
isSet(absoluteImportsOption))
184 if (parser.
isSet(rcPrefixOption))
187 if (parser.
isSet(pythonPathOption))
188 pythonPaths = parser.
value(pythonPathOption);
206 fprintf(stderr,
"Could not create output file\n");
213 bool rtn = driver.
uic(inputFile,
out);
229int main(
int argc,
char *argv[])
bool uic(const QString &fileName, QTextStream *output=nullptr)
bool printDependencies(const QString &fileName)
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
void setDescription(const QString &description)
Sets the description used for this option to description.
void setValueName(const QString &name)
Sets the name of the expected value, for the documentation, to valueName.
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.
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 constexpr QChar listSeparator() noexcept
\inmodule QtCore \reentrant
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
qsizetype size() const
Returns the number of characters in this string.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QByteArray toLocal8Bit() const &
Combined button and popup list for selecting options.
void setLanguage(Language l)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLuint * paths
GLsizei const GLchar *const * path
static QString canonicalPath(const QString &rootPath)
static const char pythonPathVar[]
static QString pythonRoot(const QString &pythonPath, const QString &uiFileIn)
int runUic(int argc, char *argv[])
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
QT_BEGIN_NAMESPACE Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char * qVersion(void) Q_DECL_NOEXCEPT
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
QTextStream out(stdout)
[7]
QApplication app(argc, argv)
[0]
unsigned int headerProtection
unsigned int forceMemberFnPtrConnectionSyntax
unsigned int implicitIncludes
unsigned int forceStringConnectionSyntax
unsigned int useStarImports
unsigned int dependencies
QString translateFunction
PythonResourceImport pythonResourceImport
unsigned int autoConnection
static Q_CORE_EXPORT void setDeterministicGlobalSeed()
\threadsafe