51 QXmlStreamReader reader;
53 ui = parseUiFile(reader);
59 const auto incls = includes->elementInclude();
65 fprintf(stdout,
"%s\n",
file.toLocal8Bit().constData());
70 const auto elementCustomWidget = customWidgets->elementCustomWidget();
77 fprintf(stdout,
"%s\n",
file.toLocal8Bit().constData());
87void Uic::writeCopyrightHeaderCpp(
const DomUI *ui)
const
91 out <<
"/*\n" << comment <<
"\n*/\n\n";
93 out <<
"/********************************************************************************\n";
96 out <<
"** Created by: Qt User Interface Compiler version " << QT_VERSION_STR <<
"\n";
98 out <<
"** WARNING! All changes made in this file will be lost when recompiling UI file!\n";
99 out <<
"********************************************************************************/\n\n";
107 return c == u
'/' ||
c == u
'*';
118void Uic::writeCopyrightHeaderPython(
const DomUI *ui)
const
123 for (
const auto &
line : lines) {
137 out <<
language::repeat(80,
'#') <<
"\n## Form generated from reading UI file '"
139 <<
"'\n##\n## Created by: Qt User Interface Compiler version " << QT_VERSION_STR
140 <<
"\n##\n## WARNING! All changes made in this file will be lost when recompiling UI file!\n"
149 const auto versionAttribute =
"version"_L1;
156DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
160 const auto uiElement =
"ui"_L1;
162 if (
reader.readNext() == QXmlStreamReader::StartElement) {
175 reader.raiseError(
"Unexpected element "_L1 +
reader.name().toString());
194 QXmlStreamReader reader;
196 ui.
reset(parseUiFile(reader));
202 double version = ui->attributeVersion().toDouble();
204 fprintf(stderr,
"uic: File generated with too old version of Qt Designer\n");
212 fprintf(stderr,
"uic: File is not a \"c++\" ui file, language=%s\n",
qPrintable(
language));
227 out <<
"# -*- coding: utf-8 -*-\n\n";
232 writeCopyrightHeaderCpp(ui);
235 writeCopyrightHeaderPython(ui);
241 writeHeaderProtectionStart();
246 if (pixFunction ==
"QPixmap::fromMimeSource"_L1 || pixFunction ==
"qPixmapFromMimeSource"_L1) {
247 fprintf(stderr,
"%s: Warning: Obsolete pixmap function '%s' specified in the UI file.\n",
273 writeHeaderProtectionEnd();
278void Uic::writeHeaderProtectionStart()
281 out <<
"#ifndef " <<
h <<
"\n"
282 <<
"#define " <<
h <<
"\n";
285void Uic::writeHeaderProtectionEnd()
288 out <<
"#endif // " <<
h <<
"\n";
294 u
"QRadioButton"_s, u
"QToolButton"_s,
295 u
"QCheckBox"_s, u
"QPushButton"_s,
296 u
"QCommandLinkButton"_s
304 u
"QStackedWidget"_s, u
"QToolBox"_s,
305 u
"QTabWidget"_s, u
"QScrollArea"_s,
306 u
"QMdiArea"_s, u
"QWizard"_s,
316 u
"QMenu"_s, u
"QPopupMenu"_s
void acceptUI(DomUI *node) override
void acceptUI(DomUI *node) override
DomWidget * elementWidget() const
QString elementPixmapFunction() const
QString elementComment() const
void read(QXmlStreamReader &reader)
DomCustomWidgets * elementCustomWidgets() const
DomIncludes * elementIncludes() const
void setUseIdBasedTranslations(bool u)
static QString headerFileName(const QString &fileName)
void acceptUI(DomUI *node) override
\inmodule QtCore \reentrant
QString fileName() const
Returns the name of the file, excluding the path.
\inmodule QtCore \reentrant
QString errorString() const
Returns a human readable description of the last error that occurred.
void setDevice(QIODevice *device)
Sets QImageReader's device to device.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
Q_CORE_EXPORT double toDouble(bool *ok=nullptr) const
Returns the string view converted to a double value.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString right(qsizetype n) const
Returns a substring that contains the n rightmost characters of the string.
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.
void clear()
Clears the contents of the string and makes it null.
qsizetype size() const
Returns the number of characters in this string.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool hasAttribute(QAnyStringView qualifiedName) const
Q_CORE_EXPORT QStringView value(QAnyStringView namespaceUri, QAnyStringView name) const noexcept
bool isButton(const QString &className) const
bool write(QIODevice *in)
const CustomWidgetsInfo * customWidgetsInfo() const
bool isMenu(const QString &className) const
bool isContainer(const QString &className) const
Combined button and popup list for selecting options.
QImageReader reader("image.png")
[1]
static QString header(const QString &name)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLfloat GLfloat GLfloat GLfloat h
#define qPrintable(string)
QT_BEGIN_NAMESPACE typedef uchar * output
const char className[16]
[1]
QTextStream out(stdout)
[7]
void acceptUI(DomUI *node) override
unsigned int headerProtection
QString messagePrefix() const
unsigned int copyrightHeader
void acceptUI(DomUI *node) override
void acceptUI(DomUI *node) override
static double versionFromUiAttribute(QXmlStreamReader &reader)
static int leadingCppCommentCharCount(QStringView s)
static bool isCppCommentChar(QChar c)