Hi all,

I want that an item reacts to a certain signal only when it is at the
top of a StackView, so I tried something like:

                Connections {
                    // Below won't work:
                    target: Stack.status === Stack.Active ? button : null
                    //target: button // ..but this works
                    onClicked: console.log("clicked")
                }

That is, making the target of the connection null unless Stack.status
== Stack.Active, but it seems it's not working.

Full example below:

import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2

Window {
    id: window
    width: 500
    height: 500
    visible: true

    Column {
        Rectangle {
            width: 100
            height: 100
            color: "gray"

            MouseArea {
                id: button
                anchors.fill: parent
                Text {
                    text: "Click Me"
                    anchors.centerIn: parent
                }
            }
        }

        StackView {
            id: stackView
            width: 100
            height: 100

            initialItem: Rectangle {
                anchors.fill: parent
                color: "green"
                Connections {
                    // Below won't work:
                    target: Stack.status === Stack.Active ? button : null
                    //target: button // ..but this works
                    onClicked: console.log("clicked")
                }
            }
        }
    }
}

Anyone know what the problem might be? The item here is definitely
active on the stack, since it's the initial (and only item).

Cheers,
Elvis
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to