Important: Please read the Qt Code of Conduct -

Is there a way to change front/back properties in a Flipable?

  • The Flipable element can easily offer nice transitions. But is there a way to change the back and/or front once they're set?

    For example, if I do this:

    Flipable {
    id: flipable
    front: Image { source: "someImage.jpg" }
    back: Image { source: "anotherImage.jpg" }

    Image {
        id: img
        source: "yetAnotherImage"

    Component.onCompleted: flipable.front = img

    It gives me this error:

    QML Flipable: front is a write-once property

    So, are there any workarounds to this? I tried a few things, but couldn't come up with a solution.
    By the way, why is there even there this limitation?

  • Moderators

    Change the source of the image, not the object. Or use a Loader.

  • [quote author="sierdzio" date="1400221623"]Change the source of the image, not the object. Or use a Loader.[/quote]

    Well, yesterday I tried something like that (not with an Image), but it gave me an error saying that I couldn't modify read-only properties; I figured since the front/back were write-only, they're children properties were read-only. Now I just tried changing the source of the Image and it worked just fine. I don't know what I was doing wrong yesterday.

    But the Image was just an example. What I really need is a way to change insert a view created and istantiated from C++ into the front/back properties.

    I was messing with the the Loader a few moments ago, and it might look the thing I need, except that I can't load the new view created from C++ with that because the component is actually instantiated in the C++ side...

Log in to reply