#include <QtGui>
#include <QtGlobal>
#include <QApplication>
#include "mainwindow.h"
#define DEBUG_TEST
#ifdef DEBUG_TEST
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
void crashMessageOutput
(QtMsgType type,
const QMessageLogContext
&,
const QString & str
) {
const char * msg = str.toStdString().c_str();
#else
void crashMessageOutput(QtMsgType type, const char *msg)
{
#endif
switch (type)
{
case QtDebugMsg:
fprintf(stderr, "Debug: %s\n", msg);
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s\n", msg);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", msg);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s\n", msg);
abort();
}
}
#endif
int main(int argc, char *argv[])
{
#ifdef DEBUG_TEST
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
qInstallMessageHandler(crashMessageOutput);
#else
qInstallMsgHandler(crashMessageOutput);
#endif
#endif
MainWindow theMainWindow;
theMainWindow.show();
return app.exec();
}
#include <QtGui>
#include <QtGlobal>
#include <QApplication>
#include "mainwindow.h"
#define DEBUG_TEST
#ifdef DEBUG_TEST
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
void crashMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
{
const char * msg = str.toStdString().c_str();
#else
void crashMessageOutput(QtMsgType type, const char *msg)
{
#endif
switch (type)
{
case QtDebugMsg:
fprintf(stderr, "Debug: %s\n", msg);
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s\n", msg);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", msg);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s\n", msg);
abort();
}
}
#endif
int main(int argc, char *argv[])
{
#ifdef DEBUG_TEST
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
qInstallMessageHandler(crashMessageOutput);
#else
qInstallMsgHandler(crashMessageOutput);
#endif
#endif
QApplication app(argc, argv);
MainWindow theMainWindow;
theMainWindow.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks