#include #include #include #define _TIME_ qPrintable (QTime::currentTime ().toString ("hh:mm:ss:zzz"))void Log(QtMsgType type, const char* msg){ QString qstrText; switch (type) { case QtDebugMsg: qstrText = QString("%1: %2").arg(_TIME_, msg); break; case QtWarningMsg: qstrText = QString("%1: %2").arg(_TIME_, msg); break; case QtCriticalMsg: qstrText = QString("%1: %2").arg(_TIME_, msg); break; case QtFatalMsg: qstrText = QString("%1: %2").arg(_TIME_, msg); exit(0); } QFile out("log.txt"); out.open(QIODevice::WriteOnly | QIODevice::Append); QTextStream ts(&out); ts< <