[Development] QtQuick.Layouts and content margins

Mitch Curtis mitch.curtis at qt.io
Mon Feb 25 13:57:47 CET 2019


> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Alberto Mardegan
> Sent: Monday, 25 February 2019 1:05 PM
> To: development at qt-project.org
> Subject: Re: [Development] QtQuick.Layouts and content margins
> 
> On 25/02/19 11:23, Mitch Curtis wrote:
> > So would it look something like this?
> >
> >     // implicit size is 118 x 64
> >     ColumnLayout {
> >         defaultLeftMargin: 12
> >         defaultRightMargin: 12
> >         defaultBottomMargin: 12
> >         defaultTopMargin: 12
> >
> >         // implicit size is 100 x 40
> >         Button {
> >             Layout.leftMargin: 6 // override default
> >         }
> >     }
> 
> Yes. Sounds good? :-)

My only issue with it is that I don't know if it will see much use outside of your use case. Usually if all items in a layout have the same margins, you would just apply those margins to the layout managing them instead. While I appreciate that that won't work in your case (because the Layout might not be within another, so the attached margin properties won't have any effect, and anchor margins are not included in its implicit size), I do wonder if there are other approaches you could take. What other options have you considered? What about just making the API that provides the style's margins available to the user so they can do it themselves?

Also, it would be good if you could provide some examples of other (more common) use cases that would benefit from this.

CCing Jan Arve since he wrote the code.

> Ciao,
>   Alberto
> 
> --
> http://www.mardy.it - Geek in un lingua international
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development


More information about the Development mailing list