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

Rutledge Shawn Shawn.Rutledge at theqtcompany.com
Mon Aug 24 09:41:21 CEST 2015


On 22 Aug 2015, at 14:41, Filippo Cucchetto <filippocucchetto at gmail.com> wrote:

> I totally agree with the solution proposed by mitch c. With the only exception that i would add a DialogButtonGroup qml element into which put the buttons. This allows us to add functions and logic without clutturing the Dialog component. Furthermore it matches the widget implementation.

My plan was basically that: to have a button box component, so you would have two ways to add buttons to the dialog: the StandardButtons enum as now, or declare the button box explicitly and put buttons inside.  And you’d be able to set buttonBox: null (or something like that) to make it go away completely.  In ApplicationWindow you need to declare a toolbar if you want one; but in the case of dialogs, the button box has to be automatically created (or exist by default) in case you simply set standardButtons, because it was introduced with that (oversimplified?) API.

But I didn’t get around to implementing that just yet.

> 
> F.
> 
> Il 22/ago/2015 13:57, "Curtis Mitch" <mitch.curtis at theqtcompany.com> ha scritto:
> 
> 
> 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.
> 
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list