qDebug() to file
Verfasst: 14. Juli 2011 15:58
Und nochmals eine Frage...
Möchte Benutzer Interaktion (zB. Button Click) per File mitloggen und habe diesen Code:
Wenn ich dann qInstallMsgHandler(SimpleLoggingHandler) aufrufe bekomme ich folgenden Fehler:
argument of type ‘void (Test4::)(QtMsgType, const char*)’ does not match ‘void (*)(QtMsgType, const char*)’
Was mache ich falsch?
Möchte Benutzer Interaktion (zB. Button Click) per File mitloggen und habe diesen Code:
Code: Alles auswählen
void SimpleLoggingHandler(QtMsgType type, const char *msg) {
QString txt;
switch (type) {
case QtDebugMsg:
txt = QString("Debug: %1").arg(msg);
break;
case QtWarningMsg:
txt = QString("Warning: %1").arg(msg);
break;
case QtCriticalMsg:
txt = QString("Critical: %1").arg(msg);
break;
case QtFatalMsg:
txt = QString("Fatal: %1").arg(msg);
abort();
}
QFile outFile("/home/dayo/mylog.txt");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << txt << endl;
}
argument of type ‘void (Test4::)(QtMsgType, const char*)’ does not match ‘void (*)(QtMsgType, const char*)’
Was mache ich falsch?