mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-04 12:15:58 +00:00
Added Qt error message redirect to PWE's log
This commit is contained in:
parent
bb7ec84397
commit
61769fefe2
@ -2,8 +2,24 @@
|
|||||||
#include "CDarkStyle.h"
|
#include "CDarkStyle.h"
|
||||||
#include <Core/Resource/Factory/CTemplateLoader.h>
|
#include <Core/Resource/Factory/CTemplateLoader.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
// Redirect qDebug output to the log file
|
||||||
|
void QtLogRedirect(QtMsgType Type, const QMessageLogContext& /*rkContext*/, const QString& rkMessage)
|
||||||
|
{
|
||||||
|
switch (Type)
|
||||||
|
{
|
||||||
|
case QtDebugMsg: Log::Write(TString("Qt Debug: ") + TO_TSTRING(rkMessage)); break;
|
||||||
|
case QtWarningMsg: Log::Write(TString("Qt Warning: ") + TO_TSTRING(rkMessage)); break;
|
||||||
|
case QtCriticalMsg: Log::Write(TString("Qt Critical: ") + TO_TSTRING(rkMessage)); break;
|
||||||
|
case QtFatalMsg: Log::Write(TString("Qt Fatal: ") + TO_TSTRING(rkMessage)); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << TO_TSTRING(rkMessage) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -13,6 +29,9 @@ int main(int argc, char *argv[])
|
|||||||
CStartWindow w;
|
CStartWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
|
// Set up debug redirect
|
||||||
|
qInstallMessageHandler(QtLogRedirect);
|
||||||
|
|
||||||
// Load templates
|
// Load templates
|
||||||
CTemplateLoader::LoadGameList();
|
CTemplateLoader::LoadGameList();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user