Sergio Martins
2fb66c681b
Item: Register the location enum for pretty debugging
2020-05-16 19:45:08 +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
3f242a8b59
tests: Test Item::suggestedDropRect() more
2020-05-16 12:37:23 +01:00
Sergio Martins
c4b94f0f21
tests: pain a background in the host and guest widgets
...
For easier visual debugging
2020-05-16 12:36:44 +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
1f6c49d5ba
Fix 5.15 build
2020-05-14 22:39:17 +01:00
Sergio Martins
d0b36cf932
add ctest to tst_multisplitter too
...
moved up otherwise the multisplitter one was being generated in
a different folder
2020-05-14 22:29:19 +01:00
Sergio Martins
d1d1c983f1
Remove "using namespace Layouting" out of the layouting lib
...
Fixes windows build due to ambiguous symbols
2020-05-14 22:02:27 +01:00
Sergio Martins
c5d880c124
Fix build on Windows
...
Location being ambiguous
2020-05-14 21:21:55 +01:00
Sergio Martins
d44a6f78b8
Fix build with older Qt
2020-05-14 21:10:46 +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
2bf977ede7
Fix build on older compilers
2020-05-14 20:42:57 +01:00
Sergio Martins
5bad616c5a
Fix some memory leaks
2020-05-14 20:34: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
be1a2a3878
Fix build on Windows
2020-05-13 20:04:48 +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
0db40953ac
fuzzer: don't dump invalid operations to the JSON
2020-05-13 19:37:47 +01:00
Sergio Martins
137cf017c4
fuzzer: add a nice place to set a breakpoint
2020-05-13 19:37:47 +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
4dea453e7c
fuzzer: Trim failling test
2020-05-11 00:25:09 +01:00
Sergio Martins
ca52d6f760
fuzzer: Add a failing test
2020-05-11 00:05:00 +01:00
Sergio Martins
5eff4f8df8
fuzzer: fix dumping to JSON skipping some operations
...
Operations that don't have any parameters werent being saved
2020-05-11 00:04:26 +01:00
Sergio Martins
cc2aa13eb7
fuzzer: Fix dockByName() returning nullptr
...
dockStr() is just for printing purposes
2020-05-10 23:44:48 +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
c4df3600af
tst_docks|fuzzer: Use offscreen QPA by default too
2020-05-10 21:26:52 +01:00
Sergio Martins
0f0209ddf3
tst_multisplitter: Use offscreen QPA by default
...
It's less anoying as it doesn't show a window
2020-05-10 21:21:20 +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
11576c5455
ECM: Only set the sanitizers for DEBUG config
...
ECMEnableSanitizers isn't being friendly of multi generators, like
-G "Ninja Multi-Config" and is messing with global flags which is a no-no.
Instead it should be using a dedicated custom config IMHO.
With this change only debug will get the sanitizers, so you can for instance
build with -DCMAKE_CONFIGURATION_TYPES=Debug;RelWithDebInfo and have Debug
hardeneded with the sanitizers while the RelWithDebInfo without sanitizers,
ideal for profiling.
2020-05-10 17:49:20 +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
2fe1e22076
Remove OPTION_SANITIZER_SUPPORT
...
We have ECM inside the repo now, so no point in guarding the include
2020-05-09 17:55:22 +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
7c85c1eb0f
Resize the layout after restoring
...
After restoring, we need to put the layout at the same size
as its widget. Most of the times this happens since we also restore
the widget's geometry. But really make sure, as something might happen
to the window geometry, like for example using RestoreOption_RelativeToMainWindow
which doesn't restore the main window geometries
2020-05-09 00:46:30 +01:00
Sergio Martins
addf436fd0
LayoutSaver: Don't load old serialization versions
2020-05-08 19:30:41 +01:00