[Interest] QML Loader unloading bug?

Jereme Lamothe jlamothe at docboxinc.com
Tue Feb 24 16:47:55 CET 2015


Try putting the states in a different / sibling item, like below:

Item {
  id: stateMachine
  states: [
    State {
      when: !controller.userManager.isLogged
      PropertyChanges { target: root; source:
Qt.resolvedUrl("MenuProfileLogin.qml") }
     },
     State {
        when: controller.userManager.isLogged
        PropertyChanges { target: root; source:
Qt.resolvedUrl("MenuProfileDetail.qml") }
     }
   ]
 }

Loader {
  id: root
  source: ""
}

I've experienced weird behavior when using states inside a Loader, and
putting it elsewhere has resolved them.

On Tue, Feb 24, 2015 at 10:28 AM, Nuno Santos <nunosantos at imaginando.pt> wrote:
> Hi,
>
> Loader is supposed to unload the content when source is set to another url or to an empty string.
>
> However, I’m not being able to have that behaviour. This is what I have.
>
> When the variable value changes, the initial item is not removed, staying below the new one.
>
> I can’t get over this…
>
> Is this a bug?
>
> Loader {
>     id: root
>     clip: true
>     source: ""
>     states: [
>         State {
>             when: !controller.userManager.isLogged
>             PropertyChanges { target: root; source: Qt.resolvedUrl("MenuProfileLogin.qml") }
>         },
>         State {
>             when: controller.userManager.isLogged
>             PropertyChanges { target: root; source: Qt.resolvedUrl("MenuProfileDetail.qml") }
>         }
>     ]
> }
>
> Regards,
>
> Nuno Santos
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list