There are two ways to change the content:

1) set one item visible while setting the old one invisble. you do that already.
2) Using a Loader and changing its source or sourceComponent

For your code, instead of the Rectangle with the id "idthisLogin" you could have a Loader will the main item

Qt Code:
  1. QtCPPSearchV4 {
  2. Loader {
  3. anchors.fill: parent
  4.  
  5. property bool loginSuccess: false
  6.  
  7. source: loginSuccess ? "MainView.qml" : "Login.qml"
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 
When the loginSuccess property changes, then the Loader's content changes.

Cheers,
_