Code review comment for lp:~zsombi/ubuntu-ui-toolkit/50-custom-delegates

Revision history for this message
Tim Peeters (tpeeters) wrote :

Please expose a pressed attached property to the custom delegate as well.

I have no way now to detect inside the custom delegate whether it is pressed. I could add a MouseArea like this:

        ListItemActions {
            id: trailActions
            actions: [
                Action {
                    iconName: "save-to"
                    text: "Move"
                    onTriggered: print("Move" +value)
                }
            ]
            delegate: Rectangle {
                color: delegateArea.pressed ? "orange" : "yellow"
                width: units.gu(10)
                Label {
                    text: action.text
                    anchors.centerIn: parent
                }
                MouseArea {
                    anchors.fill: parent
                    id: delegateArea
                    onPressed: print("press")
                }
            }
        }

but that eats the mouse events and prevents the trigger() signal on clicked.

« Back to merge proposal