[Development] Qt Quick Controls Dialogs -- enabled state of the standard buttons (API choices)

Curtis Mitch mitch.curtis at theqtcompany.com
Sat Aug 22 13:56:57 CEST 2015



________________________________
From: development-bounces+mitch.curtis=theqtcompany.com at qt-project.org <development-bounces+mitch.curtis=theqtcompany.com at qt-project.org> on behalf of Vladimir Moolle <vmoolle at ics.com>
Sent: Saturday, 22 August 2015 01:22
To: development at qt-project.org
Subject: [Development] Qt Quick Controls Dialogs -- enabled state of the standard buttons (API choices)

[snip]

6. Finally, Dialog could accept (optional) delegates for the buttons created, allowing for arbitrary customizations, i.e.:
Dialog {
    <...>
    StandardButtonDelegate {       //name arguably could be better
        role: StandardButton.Apply // could be "roles" here even
        StandardButton {           // a Button, but with default bindings for "text", etc.
            enabled: <some binding expression>
        }
    }
    StandardButtonDelegate {       //name arguably could be better
        role: StandardButton.Apply // could be "roles" here even
        Rectangle {                // a very custom "button"
       <...>
            signal clicked         // or a warning emitted by Dialog if absent
            enabled: <some binding expression>
        }
    }
}

[snip]

At this stage, wouldn't it just be easier to declare regular buttons as children of the dialog and then introduce some Dialog.buttonRole attached property? For example:

Dialog {
    Button {
        Dialog.buttonRole: StandardButton.Ok
    }
    Button {
        Dialog.buttonRole: StandardButton.Cancel
    }
}

The dialog can still take care of the layouting of the buttons, and the text would even be set for you (unless you want to set your own). We could document this as overriding the standardButtons property if both are specified for whatever reason.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150822/06864b44/attachment.html>


More information about the Development mailing list