diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index f0e0b6ddec..2c4fe3652a 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -1087,7 +1087,9 @@ int main(int argc, char **argv) parser.addOption(adapterCodeOption); QCommandLineOption classNameOption(QStringList{u"c"_s, u"classname"_s}, - u"Use as the class name for the generated classes"_s, u"classname"_s); + u"Use as the class name for the generated classes. " + u"This option can only be used when processing a single interface."_s, + u"classname"_s); parser.addOption(classNameOption); QCommandLineOption addIncludeOption(QStringList{u"i"_s, u"include"_s}, @@ -1147,6 +1149,11 @@ int main(int argc, char **argv) QDBusIntrospection::Interfaces interfaces = readInput(); cleanInterfaces(interfaces); + if (!globalClassName.isEmpty() && interfaces.count() != 1) { + qCritical("Option -c/--classname can only be used with a single interface.\n"); + return 1; + } + QStringList args = app.arguments(); args.removeFirst(); commandLine = PROGRAMNAME " "_L1 + args.join(u' ');