title: Best practice for controlling QML?
body: <p>I have this <strong>login.qml</strong> window in which I have a controller declared as follows:</p>
  
  <pre><code>Button {
      id: btnOK
      anchors.top:senhaInput.bottom
      anchors.left: senhaInput.left
      anchors.topMargin: 10
      width: (senhaInput.width * 0.60) - 5
      text: "Entrar"
      isDefault: true
      onClicked: {
          lblMsgErro.text = ""
          lblMsgErro.visible = false;
          controller.autenticar();
      }
  }
  
  QLoginController {
      id: controller
      login: loginInput.text
      senha: senhaInput.text
  
      onAuthenticated: {
          if (userId) {
              console.log("Autenticado ID: " + userId);
              var component = Qt.createComponent("main.qml");
              var win = component.createObject();
              win.userId = userId;
              win.showFullScreen();
              close();
          } else {
              senhaInput.text = "";
              console.log("Falha na autenticação: Usuário e/ou senha inválidos.");
              lblMsgErro.text = "Usuário e/ou senha inválidos.";
              lblMsgErro.visible = true;
              loginInput.focus = true;
          }
      }
  }
  </code></pre>
  
  <p>The <strong>controller.autenticar();</strong> method emits **onAuthenticated"" signal.</p>
  
  <p>Here in this <a href="https://stackoverflow.com/a/25649200/2195551">other answer</a>, the guy says that having a controller declared as a QML Object is not a good practice and shows another way of using a controller.</p>
  
  <p>So, I am asking here: How can I control the QML components (like hiding a text or closing a window) from within C++ controller signal; and so, reach the same result as it was being done within the QML file? For now I can managd things from QML to C++, but I don't know how to do the other way (C++ to QML). For example: setting a text of a Label object.</p>