Sergio Martins
283d2a80c7
Add Item::maxSizeChanged signal and improve setter
2020-05-20 14:25:42 +01:00
Sergio Martins
4a17b04310
Item::dumpDebug: Also print the max-size, if any
2020-05-19 22:48:14 +01:00
Sergio Martins
6001e655fd
Fix crash when moving separator
...
We weren't recurring up the tree to find the next separator
2020-05-19 14:46:30 +01:00
Sergio Martins
9e198917f0
Try to recover from loading an invalid layout
2020-05-19 12:35:33 +01:00
Sergio Martins
2350f847d7
Item: Dump screen information too
2020-05-18 13:46:06 +01:00
Sergio Martins
b687224801
Fix separators not moving when having invisible items
...
typo...
2020-05-18 11:40:33 +01:00
Sergio Martins
8b0be3b2ba
Add ItemContainer::layoutEqually()
...
Distributes all the space equally through the container.
Still respects min/max
2020-05-17 23:44:45 +01:00
Sergio Martins
ea56d20959
Fix clazy warnings about unused trivial variables
2020-05-17 19:15:59 +01:00
Sergio Martins
8477fdc7e1
Fix detachments
2020-05-17 19:14:50 +01:00
Sergio Martins
5b1b029b80
Fix Item::calculateSqueezes() squeezing too much
...
Fixes tst_28NestedWidgets:28 with Qt 5.9
2020-05-17 16:28:36 +01:00
Sergio Martins
131b43a833
Item: Ignore item changing min size when it's not visible
...
Fixes tst_crash2 with Qt 5.9. Added a proper test too.
2020-05-17 15:03:54 +01:00
Sergio Martins
a87ab40aad
Implement support for double-clicking a separator
...
Will resize the left and right widget, so they have the same size
2020-05-16 20:18:32 +01:00
Sergio Martins
0bd2f8f23a
tests: Add sanity checks for the tested rects
...
Catches the situtions fixed in the two previous commits.
2020-05-16 19:44:35 +01:00
Sergio Martins
0f796da901
Fix suggestedDropRect() not returning in global coords
2020-05-16 19:44:06 +01:00
Sergio Martins
cc5578f8f4
Fix inserting items in the list when there's hidden items
2020-05-16 19:43:18 +01:00
Sergio Martins
f89aa59371
Implement an exact Item::suggestedDropRect()
...
It will create a temporary, invisible layout, insert a copy of the item,
and see where it landed.
2020-05-16 18:20:48 +01:00
Sergio Martins
582ce6ef31
Item: Add pathFromRoot() and itemFromPath()
...
An easy way to identify an item within a layout.
2020-05-16 12:35:39 +01:00
Sergio Martins
10b47a8f9c
Item: Allow to have items that don't have an host QWidget
...
So we can create dummy ones, for usage in suggestDropRect()
2020-05-16 12:34:31 +01:00
Sergio Martins
d2716cf1c5
Item: Improve assert, don't dereference nullptr
2020-05-16 12:33:09 +01:00
Sergio Martins
2984b62ca0
Item: Fix warning about setSize() having an empty size
...
When doing setLength() make sure that the other dimension isn't 0,
as the item the user is trying to insert could have had an empty
size to begin with
2020-05-16 12:32:00 +01:00
Sergio Martins
0abb6292c1
Remove a sanity check, it's called from unit tests already
2020-05-14 20:53:54 +01:00
Sergio Martins
e0cd9d95b5
Pass an entire item to Item::suggestedDropRect()
...
So we can do more powerful calculations in the future
2020-05-13 22:35:02 +01:00
Sergio Martins
b743565ea3
Fix Item::suggestedRect() when the parentContainer() wasn't root
2020-05-13 22:35:02 +01:00
Sergio Martins
b7cb6afa49
Item: Also position the opposite position, not just the length
...
Fixes fuzzer test 20.json
2020-05-13 19:39:30 +01:00
Sergio Martins
68acdaeb9a
Fix Items not being connected to their parent after a restore
...
Missing connectToParent() calls.
2020-05-13 12:24:46 +01:00
Sergio Martins
c4241b92f1
Item: When restoring, only shrink the immediate neighbours
...
So it matches the behaviour of closing an item, where only immediate
neighbours grow.
Now, pressing the float button multiple times will always put the
item on the same place, and not disturb non-immediate neighbours
2020-05-10 23:24:18 +01:00
Sergio Martins
1a0299d758
Simplify the NeighbourSqueezeStrategy enum
...
And make it agnostic to how separators work, so it can shrinkNeighbours()
can be reused in other contexts.
2020-05-10 22:44:53 +01:00
Sergio Martins
550d84ab11
Rename for readability
2020-05-10 22:26:40 +01:00
Sergio Martins
2450f9b39f
Minor rename for readability
2020-05-10 22:23:36 +01:00
Sergio Martins
f6f70f26e4
Item: Also pass the neighbour shrink strategy all along
...
So we can choose another one when restoring a child
2020-05-10 22:17:59 +01:00
Sergio Martins
0dac5eed68
Item: Add DefaultSizeMode enum
...
To control how we calculate the item's initial size when
we add it
2020-05-10 21:20:31 +01:00
Sergio Martins
93c471623b
Silence -Wmaybe-uninitialized false-positive
2020-05-10 15:20:59 +01:00
Sergio Martins
925df72c0f
Fix propagation of resize when dragging a separator
...
It was ok but was resizing children via the "percentage method",
and we only want to resize the children next to the separator.
2020-05-10 15:07:42 +01:00
Sergio Martins
babed642eb
Fix warning saying item size being too small
...
If the widget's size is smaller than hardcodedMinimumSize then
it would be violating the min-size constraint
2020-05-10 12:45:58 +01:00
Sergio Martins
fd9bcdeabe
Fix crash if root() is nullptr when printing a warning
2020-05-09 18:37:35 +01:00
Sergio Martins
a9d0ec3fdd
Use a better strategy for size propagation when resizing via separator
...
Behaves like old kddockwidgets now.
When dragging a separator, only the immediate neighbours are resized.
Only when min-sizes are violated that it propagates.
2020-05-09 17:42:55 +01:00
Sergio Martins
ed6d5134b0
Implement Side1 and Side2 resizing strategies
...
to be used when dragging separators when mouse, as we don't want
a recursive resize dealing with percentages, as it doesn't need to be fair.
Items near the mouse/separator will suffer/benetif more from there resize.
Resize only propagates further when size-constraints come into action
2020-05-09 13:28:59 +01:00
Sergio Martins
1f2bdaf188
Factor out children resize logic into Item::resizeChildren()
...
as we'll have other stragies for resizing children
2020-05-09 12:49:03 +01:00
Sergio Martins
a9be454604
Item: Rename resize to setSize_recursive()
2020-05-09 12:14:08 +01:00
Sergio Martins
7e86a32a23
Readability++
...
let the reader know position isn't imported at this stage
2020-05-07 23:34:57 +01:00
Sergio Martins
09026fd312
Uncomment assert
2020-05-07 23:05:59 +01:00
Sergio Martins
3742e5ef9a
example: No persistent central frame by default
...
This is old style, which we don't use anymore by default
2020-05-07 19:32:32 +01:00
Sergio Martins
3c1ab0126d
Item: Clear and honour a bunch of TODOs
2020-05-07 18:49:00 +01:00
Sergio Martins
0df9943aa5
Fix fuzzer test 11.json and other tests that worked by luck
...
mapFrom/toRoot were wrong
2020-05-07 16:30:45 +01:00
Sergio Martins
d4cc9e85eb
Add more sanity checks to Item
...
Checks that the parentContainer and hostWidget are correct
for each separator
2020-05-07 12:35:58 +01:00
Sergio Martins
5f7899f265
Item: Remove unused methods
2020-05-07 00:08:04 +01:00
Sergio Martins
61bedce278
Separators now are able to be moved by the user with mouse
2020-05-06 22:52:36 +01:00
Sergio Martins
06a7346281
Introduce ItemContainer::availableOnSide_recursive()
...
and use it for calculating the min/max position of a separator
The min/max position of a separator isn't local to its container,
but is recursive upwards until root
2020-05-05 23:16:57 +01:00
Sergio Martins
e298667351
Remove dead code about static separators
...
Before we had separators on the left,top,bottom,right margins
with 0 width. Now we don't have this concept anymore
2020-05-04 14:28:59 +01:00
Sergio Martins
0595448bba
Replace Anchor with Separator
...
We don't have the concept of Anchors anymore. Code is now simpler
2020-05-04 13:10:38 +01:00