2018-02-13 19:00:58 +08:00
|
|
|
#include <MainWindow.h>
|
2017-04-12 05:26:33 +08:00
|
|
|
#include <QString>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
|
|
|
{
|
|
|
|
QByteArray localMsg = msg.toLocal8Bit();
|
|
|
|
switch (type) {
|
|
|
|
case QtDebugMsg:
|
|
|
|
fprintf(stdout, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtInfoMsg:
|
|
|
|
fprintf(stdout, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtWarningMsg:
|
|
|
|
fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtCriticalMsg:
|
|
|
|
fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtFatalMsg:
|
|
|
|
fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
fflush(stderr);
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
std::shared_ptr<int> b;
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
a.setQuitOnLastWindowClosed(true);
|
2018-10-31 06:45:59 +08:00
|
|
|
//qInstallMessageHandler(myMessageOutput);
|
2017-04-12 05:26:33 +08:00
|
|
|
qDebug() << "Message handler test";
|
|
|
|
|
2018-02-13 19:00:58 +08:00
|
|
|
CMainWindow mw;
|
2017-04-12 05:26:33 +08:00
|
|
|
mw.show();
|
|
|
|
return a.exec();
|
|
|
|
}
|