title: QT, using qDebug() with custom message handler does not show line/file/function info
body: <p>I have the following code taken from <a href="https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler" rel="nofollow noreferrer">https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler</a>
  I want to have access to context.file, context.line, context.function inside myMessageOutput()</p>
  <pre><code>void myMessageOutput(QtMsgType type, const QMessageLogContext &amp;context, const QString &amp;msg)
  {
      QByteArray localMsg = msg.toLocal8Bit();
      const char *file = context.file ? context.file : &quot;&quot;;
      const char *function = context.function ? context.function : &quot;&quot;;
      switch (type) {
      case QtDebugMsg:
          fprintf(stderr, &quot;Debug: %s (%s:%u, %s)\n&quot;, localMsg.constData(), file, context.line, function);
          break;
      case QtInfoMsg:
          fprintf(stderr, &quot;Info: %s (%s:%u, %s)\n&quot;, localMsg.constData(), file, context.line, function);
          break;
      case QtWarningMsg:
          fprintf(stderr, &quot;Warning: %s (%s:%u, %s)\n&quot;, localMsg.constData(), file, context.line, function);
          break;
      case QtCriticalMsg:
          fprintf(stderr, &quot;Critical: %s (%s:%u, %s)\n&quot;, localMsg.constData(), file, context.line, function);
          break;
      case QtFatalMsg:
          fprintf(stderr, &quot;Fatal: %s (%s:%u, %s)\n&quot;, localMsg.constData(), file, context.line, function);
          break;
      }
  }
  
  int main(int argc, char **argv)
  {
      qInstallMessageHandler(myMessageOutput);
      QApplication app(argc, argv);
      ...
      return app.exec();
  }
  </code></pre>
  <p>In Debug build (using `qDebug() &lt;&lt; &quot;test logging&quot;) shows details about context.line/file/number.
  In Release build that info(s) are nullptr or 0 (line).
  Reproduced on Windows (QT 5.12)</p>