[Companion][Simulator] Misc. minor fixes:

Fix Qt < 5.3 compat. issue in DebugOutput;
  AppDebugMessageHandler: Filter out verbose QPainter warnings on Linux Qt < 5.3; Do not return any instance if disabled entirely;
  Fix style sheet for simulator radio background.
This commit is contained in:
Max Paperno
2017-03-06 06:28:33 -05:00
parent 0e906162e1
commit 6c493fddd9
3 changed files with 17 additions and 6 deletions
+9 -3
View File
@@ -33,8 +33,10 @@ AppDebugMessageHandler::AppDebugMessageHandler(QObject * parent) :
AppDebugMessageHandler * AppDebugMessageHandler::instance()
{
static AppDebugMessageHandler * _instance = NULL;
#if APP_DBG_HANDLER_ENABLE
if(_instance == NULL && !qApp->closingDown())
_instance = new AppDebugMessageHandler(qApp); // Ensure this object is cleaned up when the QApplication exits.
#endif
return _instance;
}
@@ -55,9 +57,7 @@ void AppDebugMessageHandler::setShowFunctionDeclarations(bool showFunctionDeclar
void AppDebugMessageHandler::installAppMessageHandler()
{
#if APP_DBG_HANDLER_ENABLE
m_defaultHandler = qInstallMessageHandler(g_appDebugMessageHandler);
#endif
}
void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogContext & context, const QString & msg)
@@ -73,6 +73,12 @@ void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogCon
if (lvl < m_appDebugOutputLevel && type != QtFatalMsg)
return;
#if defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
// Filter out lots of QPainter warnings from undocked QDockWidgets... hackish but effective (only workaround found so far)
if (lvl == 2 && QString(context.function).contains("QPainter::"))
return;
#endif
QString msgPattern = QString("[%1] ").arg(symbols[type]);
if (m_showSourcePath) {
@@ -101,7 +107,7 @@ void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogCon
msgPattern.replace("%{message}", msg);
if (!m_showFunctionDeclarations) {
QString func = context.function;
msgPattern.replace(QString("%{function}"), func.replace(m_functionFilter, "\\1)"));
msgPattern.replace("%{function}", func.replace(m_functionFilter, "\\1)"));
}
#endif