diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp
index 691e723f54c5562bc659d33117f4bc02ccfc832b..1fbcaa80f2a8cad0be6cfde578ce87cfe6b87789 100644
--- a/tools/dumpcpp/main.cpp
+++ b/tools/dumpcpp/main.cpp
@@ -893,6 +893,15 @@ void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray
     out << '}' << endl;
 }
 
+static void formatCommentBlockFooter(const QString &typeLibFile, QTextStream &str)
+{
+    str << " generated by dumpcpp v" << QT_VERSION_STR << " using\n**";
+    foreach (const QString &arg, QCoreApplication::arguments())
+        str << ' ' << arg;
+    str << "\n** from the type library " << typeLibFile << "\n**\n"
+        << "****************************************************************************/\n\n";
+}
+
 bool generateTypeLibrary(QString typeLibFile, QString outname,
                          const QString &nameSpace, ObjectCategory category)
 {
@@ -947,13 +956,9 @@ bool generateTypeLibrary(QString typeLibFile, QString outname,
             return false;
         }
 
-        implOut << "/****************************************************************************" << endl;
-        implOut << "**" << endl;
-        implOut << "** Metadata for " << libName << " generated by dumpcpp from type library" << endl;
-        implOut << "** " << typeLibFile << endl;
-        implOut << "**" << endl;
-        implOut << "****************************************************************************/" << endl;
-        implOut << endl;
+        implOut << "/****************************************************************************\n"
+                   "**\n** Metadata for " << libName;
+        formatCommentBlockFooter(typeLibFile, implOut);
 
         implOut << "#define QAX_DUMPCPP_" << libName.toUpper() << "_NOINLINES" << endl;
 
@@ -978,13 +983,9 @@ bool generateTypeLibrary(QString typeLibFile, QString outname,
             return false;
         }
 
-        declOut << "/****************************************************************************" << endl;
-        declOut << "**" << endl;
-        declOut << "** Namespace " << libName << " generated by dumpcpp from type library" << endl;
-        declOut << "** " << typeLibFile << endl;
-        declOut << "**" << endl;
-        declOut << "****************************************************************************/" << endl;
-        declOut << endl;
+        declOut << "/****************************************************************************\n"
+                   "**\n** Namespace " << libName;
+        formatCommentBlockFooter(typeLibFile, declOut);
 
         QFileInfo cppFileInfo(outname);
         writeHeader(declOut, libName, cppFileInfo.fileName());