[Interest] QtQuick Window visible property

Shantanu Tushar shaan7in at gmail.com
Fri Jun 10 10:24:47 CEST 2016


Hi,

Lets consider the following example-

ApplicationWindow {
    visible: true
    width: 640
    height: 480

    Button {
        id: button
        checkable: true
        text: "Hello"
    }

    Window {
        id: window2
        visible: button.checked
    }
}

So essentially whenever the button is checked, window2 is visible and when
the button is unchecked then window2 is hidden.
Now, consider the following steps-
1. I click the "Hello" button, window2 is shown
2. I click the 'X' button on window2 to close it.
3. I uncheck and check the "Hello" button again.
4. window2 shows up.

Now, given my understanding of QML bindings, by performing step 2 I am
causing visible to be set to false manually. This should invalidate the
binding "visible: button.checked"[1]. However, that doesn't seem to happen
because in step 4 the window shows up again!

Any idea why this happens? Did I understand bindings incorrectly or is it
some other magic?

[1] "However, if the property is later assigned a static value from a
JavaScript statement, the binding will be removed."
http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html

Thanks,

-- 
Shantanu Tushar    (UTC +0530)
shantanu.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160610/3638060c/attachment.html>


More information about the Interest mailing list