________________________________
From: development-bounces+mitch.curtis=theqtcompany....@qt-project.org 
<development-bounces+mitch.curtis=theqtcompany....@qt-project.org> on behalf of 
Vladimir Moolle <vmoo...@ics.com>
Sent: Saturday, 22 August 2015 01:22
To: development@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.

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to