diff options
| author | Thiago Macieira <[email protected]> | 2023-08-10 10:07:08 -0700 |
|---|---|---|
| committer | Thiago Macieira <[email protected]> | 2023-08-14 20:19:36 -0700 |
| commit | 56bd5d60c9fb9b9078847e4c4919956af3cbf08a (patch) | |
| tree | 05045c4792407f4aee96d8d2fcaf675276dc74e5 /src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | |
| parent | 7a1ffacca0096125603b99a58f651c322468db27 (diff) | |
Fix registration of QtDBus types' metatypes
By actually registering them.
Commit 850d850c5af8ff77a4b9d53457ec6b1ba6c20cb3 changed from
qMetaTypeId<QDBusArgument>() to QMetaType::fromType<QDBusArgument>() and
in Qt 6, fromType() does not register the type with the database. That
means the lines became runtime no-ops at that time or during the
QMetaType updates since 6.0. All they did was instantiate the C++ inline
variable.
The testing also detected we didn't register QList<QDBusVariant> as an
alias for the "av" signature. I'm not entirely sure you're allowed to
use this because QtDBus does not like re-registration of the built-in
types, and "av" is already assigned to QVariantList. This is no trouble
for the parser, anyway.
Minor change to qdbuscpp2xml to allow reading from stdin, so we don't
have to create temporary files.
Pick-to: 6.5 6.6
Fixes: QTBUG-115964
Change-Id: I80612a7d275c41f1baf0fffd177a14925e7d23ac
Reviewed-by: Ievgenii Meshcheriakov <[email protected]>
Diffstat (limited to 'src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp')
| -rw-r--r-- | src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 295a60c01a4..7182e923f3b 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -433,12 +433,20 @@ int main(int argc, char **argv) QList<ClassDef> classes; + if (args.isEmpty()) + args << u"-"_s; for (const auto &arg: std::as_const(args)) { - if (arg.startsWith(u'-')) + if (arg.startsWith(u'-') && arg.size() > 1) continue; - QFile f(arg); - if (!f.open(QIODevice::ReadOnly|QIODevice::Text)) { + QFile f; + if (arg == u'-') { + f.open(stdin, QIODevice::ReadOnly | QIODevice::Text); + } else { + f.setFileName(arg); + f.open(QIODevice::ReadOnly | QIODevice::Text); + } + if (!f.isOpen()) { fprintf(stderr, PROGRAMNAME ": could not open '%s': %s\n", qPrintable(arg), qPrintable(f.errorString())); return 1; |
