[Interest] Row(Layout), use spacing as resize handle. How to do that?

Saether Jan-Arve Jan-Arve.Saether at digia.com
Tue Mar 4 08:00:57 CET 2014


> -----Original Message-----
> From: Mark Gaiser [mailto:markg85 at gmail.com]
> Sent: 3. mars 2014 13:10
> To: Saether Jan-Arve
> Cc: Qt Interest
> Subject: Re: [Interest] Row(Layout), use spacing as resize handle. How 
> to do that?
> On Mon, Mar 3, 2014 at 12:53 PM, Saether Jan-Arve <Jan-
> Arve.Saether at digia.com> wrote:
>> 
>> 
>>> -----Original Message-----
>>> From: Mark Gaiser [mailto:markg85 at gmail.com]
>>> 
>>> Now i've actually tested the SplitView :) And it behaves
>>> differently compared to RowLayout. In a bad way.
>>> In a row layout something like:
>>> 
>>>         RowLayout {
>>>             anchord.fill: parent
>>>             
>>>             Rectangle {
>>>                 Layout.fillWidth: true
>>>                 Layout.fillHeight: true
>>>                 color: "red"
>>>             }
>>>             
>>>             Rectangle {
>>>                 Layout.fillWidth: true
>>>                 Layout.fillHeight: true
>>>                 color: "green"
>>>             }
>>>         }
>>> results in red and green being evenly distributed. In a SplitView
>>> that is not the case. There the first rectangle (the red one) is
>>> getting all the space. Green is on the right and all you see is the
>>> splitter to "drag it in". Just change "RowLayout" to "SplitView"
>>> and you will see what i mean.
>>> 
>>> Bug report time?
>>> 
>> No, this is not a bug. This was a design decision for SplitView.
>> Note that, the only thing that is shared between SplitView and
> RowLayout is the "Layout" attached property. Its distribution policy
> is completely different.
> 
> I was afraid you would say that.
> Is there a reason for it? Since it "feels" inconsistent when comparing
> to RowLayout.
Yes, it's inconsistent with RowLayout, but SplitView is not a layout. Therefore, it is consistent ;)

SplitView is more like the Row positioner where one item can be interactively resized. And the minimum and maximum sizes are only enforced during the interactive resize. The reason why it uses the "Layout" attached property was discussed during our design phase, and the main argument for using it was a smaller API (we didn't have to duplicate similar concepts).

Jan Arve





More information about the Interest mailing list