Skip to content
Snippets Groups Projects
Verified Commit 8011714a authored by Burak Hançerli's avatar Burak Hançerli :headphones:
Browse files

fix: warnings from the qml project are forwarded twice

parent 41c3790a
No related branches found
No related tags found
1 merge request!81fix: warnings from the qml project are forwarded twice (QDS-14772)
Pipeline #79900 passed
......@@ -7,6 +7,18 @@
#ifdef Q_OS_ANDROID
#include <android/log.h>
#else
enum android_LogPriority {
ANDROID_LOG_UNKNOWN = 0,
ANDROID_LOG_DEFAULT,
ANDROID_LOG_VERBOSE,
ANDROID_LOG_DEBUG,
ANDROID_LOG_INFO,
ANDROID_LOG_WARN,
ANDROID_LOG_ERROR,
ANDROID_LOG_FATAL,
ANDROID_LOG_SILENT,
};
#endif
class Logger : public QObject
......@@ -30,28 +42,35 @@ public:
const char *file = context.file ? context.file : "";
const char *function = context.function ? context.function : "";
enum android_LogPriority logPriority;
switch (type) {
case QtDebugMsg:
logPrefix = QStringLiteral("Debug: ");
logPriority = ANDROID_LOG_DEBUG;
break;
case QtInfoMsg:
logPrefix = QStringLiteral("Info: ");
logPriority = ANDROID_LOG_INFO;
break;
case QtWarningMsg:
logPrefix = QStringLiteral("Warning: ");
logPriority = ANDROID_LOG_WARN;
break;
case QtCriticalMsg:
logPrefix = QStringLiteral("Critical: ");
logPriority = ANDROID_LOG_ERROR;
break;
case QtFatalMsg:
logPrefix = QStringLiteral("Fatal: ");
logSuffix = QStringLiteral(" (%1:%2, %3)").arg(file).arg(context.line).arg(function);
logPriority = ANDROID_LOG_FATAL;
break;
}
newLog += logPrefix + localMsg + logSuffix + "\n";
#ifdef Q_OS_ANDROID
__android_log_print(ANDROID_LOG_DEBUG, "Qt_UI_Viewer", "%s", qPrintable(newLog));
__android_log_print(logPriority, "Qt_UI_Viewer", "%s", qPrintable(newLog));
#else
fprintf(stderr, "%s", qPrintable(newLog));
#endif
......
......@@ -255,15 +255,6 @@ bool ProjectManager::runProjectInternal(const QByteArray &project)
m_qmlEngine->addImportPath(importPath);
}
QObject::connect(m_qmlEngine.data(),
&QQmlEngine::warnings,
this,
[&](const QList<QQmlError> &warnings) {
for (const auto &warning : warnings) {
qWarning() << warning.toString();
}
});
qDebug() << "Loading mainQmlUrl: " << mainQmlUrl.toString();
m_qmlComponent.reset(new QQmlComponent(m_qmlEngine.data()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment