[Interest] Global QML slot?

Mark markg85 at gmail.com
Wed Nov 7 23:35:44 CET 2012


Hi,

I have this case where i'm emitting a signal inside a repetitive
structure like so:

    Row {
        Repeater {
            model: 10
            delegate: MyRectangle {
                signal someEvent(int number)
                color: "red"

                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        parent.someEvent(index)
                    }
                }
            }
        }
    }

In this case the delegate is a MyRectangle for demonstration purposes.
In reality that delegate is separated out in a new file.

The question is, how can i catch all those "someEvent" signals in one slot?

I was hoping to be able to do something like:
MyRectangle.onSomeEvent: {
    ...
}

But that doesn't work. The intention here was that
MyRectangle.onSomeEvent would catch all the "someEvent" signals from
the repeater..

Any ideas..?

Cheers,
Mark



More information about the Interest mailing list