Commit Graph

1193 Commits

Author SHA1 Message Date
Sergio Martins
af25af1259 Add MainWindow::layoutEqually()
Distributes the space equally between all dock widgets
2020-05-18 00:05:50 +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
43fafa1f33 Fix -Wextra-semi 2020-05-17 22:32:08 +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
d613d25ef5 Add missing emit keyword 2020-05-17 19:12:09 +01:00
Sergio Martins
c5d9b38fc2 Disable copy of polymorphic types 2020-05-17 19:11:45 +01:00
Sergio Martins
36061fc6dc Fix detach of temporary 2020-05-17 19:08:07 +01:00
Sergio Martins
2b6b6e2ba5 Disable copy for LayoutSaver, it has a dtor, but no copy-ctor 2020-05-17 19:07:26 +01:00
Sergio Martins
adedcfd6db Use fully qualified types in signals 2020-05-17 19:06:24 +01:00
Sergio Martins
a9e02ccd41 example: Don't leak the dock widgets on shutdown 2020-05-17 18:02:03 +01:00
Sergio Martins
4647814aae Fix tests with Qt 5.9
QTabWidget is a bit flaky and changes min width at unexpected times.
Which is fine but we can't compare against the expected min size
since it changes. So just check sanity of the restored layout
2020-05-17 17:12:31 +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
6fe998d9df Add build* to .gitignore 2020-05-17 15:04:53 +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
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