Commit Graph

79 Commits

Author SHA1 Message Date
Sergio Martins
4e88b3742d Honour max-size when docking
Layout will choose a suitable size for the dock widget when
addDockWidget() is called
2020-05-29 09:53:51 +01:00
Sergio Martins
a66e750f7d Add Frame::biggestDockWidgetMaxSize() 2020-05-28 23:47:03 +01:00
Sergio Martins
d8af06a7ee Rename Item::maxSize to Item::maxSizeHint
It will more of an hint than really enforced in all cases
2020-05-28 20:20:24 +01:00
Sergio Martins
aa7107bde2 Silence some warnings on Windows 2020-05-26 16:13:56 +01:00
Sergio Martins
314cd6649d Item: also emit numVisibleItemsChanged when inserting a container
Since it can have items inside too
2020-05-25 23:27:13 +01:00
Sergio Martins
8461f1f79e kddockwidgets_multisplitter is now a library of its own 2020-05-25 06:45:13 +01:00
Sergio Martins
ab90da3b19 Readability: Rename Item::guest() and Item::widget()
Their name wasn't matching their return value
2020-05-24 20:52:23 +01:00
Sergio Martins
45f4d9f6a8 Item no longer depends on QWidget 2020-05-24 20:47:58 +01:00
Sergio Martins
ba49e1cbe2 Separator no longer inherits from QWidget
Only SeparatorWidget does
2020-05-24 20:29:49 +01:00
Sergio Martins
de0bcf9ce3 readability: Rename asWidget() to asQWidget() 2020-05-24 20:03:02 +01:00
Sergio Martins
e28f82dcad Make Item::hostWidget be a Layouting::Widget instead of QWidget
Just an abstraction preparing for QQuickItem support
2020-05-24 17:31:37 +01:00
Sergio Martins
7016656264 Rename GuestInterface to Widget
So we can use it to abstract the host too, not just the guest.
2020-05-24 15:23:10 +01:00
Sergio Martins
7f981a1d1d Item cleanup, moved LengthOnSide to impl 2020-05-24 14:05:04 +01:00
Sergio Martins
4fab2cf360 Move more code into GuestWidget 2020-05-23 20:11:27 +01:00
Sergio Martins
e75b47737c Move GuestInterface into its own file 2020-05-23 18:59:58 +01:00
Sergio Martins
9ad6eefa7a Add Layouting::Config
To host many of the scatered static member variables which
held some settings that rarely change
2020-05-23 18:40:20 +01:00
Sergio Martins
71c7a7c9a9 Move more ItemContainer members to private 2020-05-23 16:46:43 +01:00
Sergio Martins
72c2586e20 Item: move a bunch of members to the private impl 2020-05-22 21:30:24 +01:00
Sergio Martins
986a25971e Also print the widget geometry if it's different from the item 2020-05-22 15:56:02 +01:00
Sergio Martins
ba740a4934 Do a complete relayout if the loaded json layout isn't valid
The layout can be valid on disk might it might happen that
the guest QWidgets have different min-sizes now (in a different
run of our app), so we need to relayout
2020-05-20 21:30:55 +01:00
Sergio Martins
88b830d297 set the max size on the item too when setting the guest widget
Not honoured yet
2020-05-20 14:33:27 +01:00
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