D15333: Group Widget + Color Picker = Widget Out Of Bounds

Oleg Solovyov noreply at phabricator.kde.org
Thu Sep 27 09:17:48 BST 2018


McPain added inline comments.

INLINE COMMENTS

> davidedmundson wrote in main.qml:111
> Please explain the rationale behind this.
> 
> Especially the spacer.width being divided by 2 in the second part of the statement.

> Especially the spacer.width being divided by 2 in the second part of the statement.

Look at all the parentheses I wrote ;)
I divide by two a *subtraction* of spacer.width from width.

Former we calculated a button size to fit the whole widget vertically (if the layout is horizontal) and vice versa but what if we don't have enough space to fit the widget horizontally?

We have a 100x100 field. Okay, let height = 90 (margins, etc)
Then, first button 90x90, spacer 5x90 (still okay), and one more button 90x90 (oops, fail: the widget is 185x90)

Now we check the second dimension and shrink the buttons when necessary.
First button 45x45, spacer 5x45, second button 45x45. The widget if 95x45, and it fits now.

So, we have to subtract spacer width from parent width and divide it by 2, because we have two buttons and check if it's smaller than height. If so, we fit in the width.

Same thing when layout is vertical.

REPOSITORY
  R114 Plasma Addons

REVISION DETAIL
  https://phabricator.kde.org/D15333

To: McPain, #plasma, ngraham
Cc: davidedmundson, cfeck, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180927/4292cf90/attachment.html>


More information about the Plasma-devel mailing list