diff --git a/main.cpp b/main.cpp --- a/main.cpp +++ b/main.cpp @@ -19,12 +19,24 @@ #include "mainwindow.h" #include +#include + +MainWindow* pMainWindow; + +void messageHandler(QtMsgType type, const QMessageLogContext &context, + const QString &msg) +{ + pMainWindow->messageHandler(type, context, msg); +} int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; + pMainWindow = &w; + + qInstallMessageHandler(messageHandler); + w.show(); - return a.exec(); }