Commit Graph

247 Commits

Author SHA1 Message Date
Sergio Martins
d05c1adcd7 tests: Allow EventFilter wait for any event 2019-07-14 20:14:42 +01:00
Sergio Martins
c1563b6f86 Fix bug where widget didn't have the correct size after restored
Because the anchor already had the correct position it wouldn't
update the widget size
2019-07-14 18:32:19 +01:00
Sergio Martins
5fe3d72732 Clean windows at end of test 2019-07-14 17:07:57 +01:00
Sergio Martins
320556c775 Add a failing unit-test
The widget isn't being resized
2019-07-14 16:56:13 +01:00
Sergio Martins
c7f0eb704a Abstract widgets min sizes behind Item
The layout now only consults Item for the min size, never
the widgets directly. The reason is Item in the future will have
to detect the widget's min size changing, so it's better encapsulated
this way. Also decouples the layout from QWidget a bit, so in the future
we can support QML

The direct consequence is fixing the warnings about size constraints
not being honoured, due to widget getting different min size and we not
resizing
2019-07-14 14:20:11 +01:00
Sergio Martins
353dc4474c Fix restoring a floating window in some cases
MultiSplitterLayout::unrefOldPlaceholders() was clear all placeholder
references for that dock widget, but when using addMultiSplitter()
we don't create a new Item, we just steal the Items from the source
multi splitter, so we need to preserve those refs

Added unit-test
2019-07-14 13:08:24 +01:00
Sergio Martins
8fdb6fb5de Improve failing test 2019-07-13 13:39:43 +01:00
Sergio Martins
8d2206c137 Add a comment 2019-07-13 12:59:59 +01:00
Sergio Martins
f55f90e575 Remove wrong assert, the Item can be still being refed by other widgets
Like dock widgets that where set floating and remember their previous
positions. The item will only be deleted if refcount is 0
2019-07-13 12:57:06 +01:00
Sergio Martins
bb59b3bedb Add a failing test 2019-07-13 12:45:53 +01:00
Sergio Martins
105bb6770b Add a failing test for a feature we don't support yet
When adding a dock widget to a tab we don't check its minimum size
and we don't resize the layout, yet.
2019-07-13 03:01:53 +01:00
Sergio Martins
7709803e57 Make the setFollowee() stuff much simpler
It was getting quite crazy to figure out which anchors to follow
when restoring dock widgets in complex layouts full of hidden items.

Now, the approach is much simpler, we just call setFollowee(nullptr)
on all anchors, then swipe left and right, top and bottom and
set the anchors that really need to follow
2019-07-12 12:58:11 +01:00
Sergio Martins
f0e9a4f1bc Add another failing test 2019-07-11 14:10:25 +01:00
Sergio Martins
b4864d156f Don't assert that the group is squashed
It can happen
2019-07-11 14:02:11 +01:00
Sergio Martins
e5fbbdae6c Improve finding the right anchors for restoring placeholders 2019-07-11 12:58:35 +01:00
Sergio Martins
dab0694dbc Introduce Anchor::findNearestAnchorWithItems()
As a cleaner alternative than abusing AnchorGroup::turnIntoPlaceholder()
as the item was already a placeholder
2019-07-10 19:11:10 +01:00
Sergio Martins
90502ae5c7 When adding widgets relative to placeholders don't forget to set following 2019-07-10 18:24:33 +01:00
Sergio Martins
91704fd486 Uncomment a few tests that are passing 2019-07-10 16:39:30 +01:00
Sergio Martins
3f73a99a71 Update followers whenever the followee anchor is deleted 2019-07-10 16:10:30 +01:00
Sergio Martins
fa23d954b1 Add a failing unit-test 2019-07-10 15:34:13 +01:00
Sergio Martins
b8d5fefbf1 Allow to add a dock widget directly as a placeholder
So it's not visible at startup if not needed
2019-07-10 12:24:36 +01:00
Sergio Martins
9052d93794 Fix adding a widget to a layout that already contains it
It should work, since we can be moving a widget to another
location
2019-07-10 11:20:20 +01:00
Sergio Martins
2c989ad5e8 Validate the parameters before creating the Frame
otherwise we're left with a dummy frame
2019-07-09 22:43:55 +01:00
Sergio Martins
c682a6966e Add tests for several stealing scenarios 2019-07-09 21:33:49 +01:00
Sergio Martins
66995c1ff9 Warn when there's dock widgets with duplicate name 2019-07-09 11:01:55 +01:00
Sergio Martins
30feb6c221 Fix unit-tests when the debug window is visible
the unit-tests make sure that no window survives after each test
2019-07-09 10:54:43 +01:00
Sergio Martins
4818b22575 Fix typo 2019-07-09 09:56:18 +01:00
Sergio Martins
11f6fc53f9 Fix resize propagation when dragging separators
Never call setPosition() directly in an Anchor that's following
another, instead do it in its folowee
2019-07-08 18:09:57 +01:00
Sergio Martins
feed814d7c Fix crash 2019-07-08 15:49:00 +01:00
Sergio Martins
efea35a948 Add a failing test 2019-07-08 15:41:04 +01:00
Sergio Martins
1ac2a52ba6 Fix redistributing space after a window resize when there's placeholders
It was using the anchor->minPosition() of anchors that only had placeholders
on Side1, which is bogus. Instead, we should use the last valid minPosition
2019-07-08 15:03:14 +01:00
Sergio Martins
1324427453 Fix size calculations when restoring a placeholder 2019-07-08 12:20:17 +01:00
Sergio Martins
82e9b8ec9e Don't count thickness of hidden/placeholder anchor 2019-07-07 22:29:44 +01:00
Sergio Martins
24d132e3a1 Add a failing unit-test 2019-07-06 11:22:54 +01:00
Sergio Martins
b6c4cd6f2e Set the SeparatorWidgets that are following, invisible
Users shouldn't interact with them.
Fixes mouse not working propertly and also ilegal resizes
if people do use them
2019-07-05 19:02:46 +01:00
Sergio Martins
81b8922ec8 Fix creation of the placeholders for more complex scenarios
We were changing the position for anchors that weren't good
candidates, has they had non-placeholder items
2019-07-05 17:39:34 +01:00
Sergio Martins
bc9a7dcc83 tests: Add a failing test 2019-07-05 16:16:43 +01:00
Sergio Martins
279532782b Fix unintended fallthrough, missing return 2019-07-05 15:50:59 +01:00
Sergio Martins
84e467a28d tests: Move the _data() method next to the respective test 2019-07-05 14:58:41 +01:00
Sergio Martins
52596c11d6 Refactor AnchorGroup::turnIntoPlaceholder a bit
Now honours chains of folowees
2019-07-05 14:40:56 +01:00
Sergio Martins
9dc74fd8cb Add failing test 2019-07-05 09:23:01 +01:00
Sergio Martins
8c4d373849 Add Anchor::isStaticOrFollowsStatic() 2019-07-04 22:59:03 +01:00
Sergio Martins
35e82b4e86 Fix anchoring "following" when creating placeholders
Sometimes, there's already some other anchor that's following
an anchor outside of the group, like when we have two adjacent
placeholders
2019-07-04 18:45:13 +01:00
Sergio Martins
49c4b5de18 Fix crash due to holding a reference to a QVector element
When the QVector reallocates it invalidates the references
2019-07-04 18:04:52 +01:00
Sergio Martins
8c402f780d Add a failing test 2019-07-04 17:00:54 +01:00
Sergio Martins
b5e932258e Fix position calculation when restoring placeholders
It was going out of bounds. We need to respect the bounds
of each anchor
2019-07-04 14:58:31 +01:00
Sergio Martins
434bf5b1e0 Fix two anchors following each other 2019-07-04 10:36:15 +01:00
Sergio Martins
3059965bbe Remove unused variable 2019-07-03 22:33:44 +01:00
Sergio Martins
d29eaee49a Remove unused variable 2019-07-03 22:32:15 +01:00
Sergio Martins
d5a05c4f38 Tests++ 2019-07-03 22:29:53 +01:00