Skip to content

Commit 21643e7

Browse files
committed
I turns out that the syncqt tool does not create a correct hex version
parse the string version instead
1 parent 6df6025 commit 21643e7

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

generator/main.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ bool preprocess(const QString& sourceFile, const QString& targetFile, const QStr
307307

308308
unsigned int getQtVersion(const QStringList& paths)
309309
{
310-
QRegularExpression re("#define\\s+QTCORE_VERSION\\s+0x([0-9a-f]+)", QRegularExpression::CaseInsensitiveOption);
310+
QRegularExpression re(R"*(#define\s+QTCORE_VERSION_STR\s+"(\d+)\.(\d+)\.(\d+)")*",
311+
QRegularExpression::CaseInsensitiveOption);
311312

312313
// Iterate through provided paths to find the qtcoreversion.h header file
313314
for (const QString& path : paths) {
@@ -340,14 +341,7 @@ unsigned int getQtVersion(const QStringList& paths)
340341
f.close();
341342
auto match = re.match(content);
342343
if (match.isValid()) {
343-
unsigned int result;
344-
bool ok;
345-
result = match.captured(1).toUInt(&ok, 16);
346-
if (!ok) {
347-
printf("Could not parse Qt version in file [%s] (looked for #define QTCORE_VERSION)\n",
348-
qPrintable(filePath));
349-
}
350-
return result;
344+
return (match.captured(1).toUInt() << 16) + (match.captured(2).toUInt() << 8) + match.captured(3).toUInt();
351345
}
352346
}
353347
}

0 commit comments

Comments
 (0)