diff options
Diffstat (limited to 'tools/qmlplugindump/main.cpp')
-rw-r--r-- | tools/qmlplugindump/main.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index d53005109e..e53d8c2800 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -684,8 +684,26 @@ void printUsage(const QString &appName) appName)) << std::endl; } +inline std::wostream &operator<<(std::wostream &str, const QString &s) +{ +#ifdef Q_OS_WIN + str << reinterpret_cast<const wchar_t *>(s.utf16()); +#else + str << s.toStdWString(); +#endif + return str; +} + +void printDebugMessage(QtMsgType, const QMessageLogContext &, const QString &msg) +{ + std::wcerr << msg << std::endl; + // In case of QtFatalMsg the calling code will abort() when appropriate. +} + int main(int argc, char *argv[]) { + // The default message handler might not print to console on some systems. Enforce this. + qInstallMessageHandler(printDebugMessage); #ifdef Q_OS_UNIX // qmldump may crash, but we don't want any crash handlers to pop up // therefore we intercept the segfault and just exit() ourselves |