title: qt quick 2 printing with console
body: <p>I can't figure out how to print with console.log inside a qt quick application.</p>
  
  <p>I have this .pro file:</p>
  
  <pre><code>TEMPLATE = app
  
  QT += qml quick
  CONFIG += c++11
  CONFIG += console
  
  SOURCES += main.cpp
  
  RESOURCES += qml.qrc
  
  # Additional import path used to resolve QML modules in Qt Creator's code model
  QML_IMPORT_PATH =
  
  # Default rules for deployment.
  include(deployment.pri)
  </code></pre>
  
  <p>this is main.cpp:</p>
  
  <pre><code>#include &lt;QGuiApplication&gt;
  #include &lt;QQmlApplicationEngine&gt;
  
  int main(int argc, char *argv[]) {
      QGuiApplication app(argc, argv);
  
      QQmlApplicationEngine engine;
      engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
  
      return app.exec();
  }
  </code></pre>
  
  <p>this is main.qml:</p>
  
  <pre><code>import QtQuick 2.5
  import QtQuick.Window 2.0
  
  Window {
     visible: true
     Text {
        anchors.centerIn: parent
        text: "Hello World"
     }
     Component.onCompleted: console.log("foo")
  }
  </code></pre>
  
  <p>Why it doens't print "foo"?</p>