title: How to modify a QML Text from C++
body: <p>I'm new to Qt and I'm trying to modify a QML Text (showed in the screen) from the C++ code.
  I get the text modified but it is not updated on the screen, so I have the text variable modified but the first text on the screen.</p>
  
  <p>Here is the code:</p>
  
  <p>//main.cpp</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QDeclarativeEngine&gt;
  #include &lt;QDeclarativeComponent&gt;
  #include &lt;QDeclarativeItem&gt;
  #include &lt;QDebug&gt;
  #include "qmlapplicationviewer.h"
  
  Q_DECL_EXPORT int main(int argc, char *argv[])
  {
      QScopedPointer&lt;QApplication&gt; app(createApplication(argc, argv));
  
      QmlApplicationViewer viewer;
      viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
      viewer.setMainQmlFile(QLatin1String("qml/textModification/main.qml"));
      viewer.showExpanded();
  
      QDeclarativeEngine engine;
      QDeclarativeComponent component(&amp;engine, QUrl::fromLocalFile("qml/textModification/main.qml"));
      QObject *object = component.create();
  
      QObject *item = qobject_cast&lt;QDeclarativeItem*&gt;(object);
      QObject *text = item-&gt;findChild&lt;QObject*&gt;("text1");
      qDebug() &lt;&lt; "Text of 'text1' when it's created' --------&gt;" &lt;&lt; text-&gt;property("text");
  
      text-&gt;setProperty("text", "THIS WORKS!");
  
      qDebug() &lt;&lt; "Text of 'text1' after modifying it --------&gt;" &lt;&lt; text-&gt;property("text");
  
      return app-&gt;exec();
  }
  </code></pre>
  
  <p>//main.qml</p>
  
  <pre><code>import QtQuick 1.0
  
  Item {
      id: item1
      objectName: "item1"
      width: 400
      height: 400
  
      Text {
  
          id: text1
          objectName: "text1"
          x: 0
          y: 0
          width: 400
          height: 29
          text: "This text should change..."
          font.pixelSize: 12
      }
  
  }
  </code></pre>
  
  <p>Could someone help me?</p>