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
The layouting was becoming too complex to maintain and to introduce
new features. Was even buggy, the fuzzer was constantly finding
bugs, which took hours to workaround.
Problem with the old layout engine is that there was a catch 22, between
Items driving the separators, and separators driving the anchors.
The new layout is much simpler, both in implementation and conceptually.
There's simply a recursive hierarchy of Item elements. An Item can either
have a QWidget to show, or be a ItemContainer, which contains Item children,
and so forth. Each ItemContainer is either vertical or horizontal. That's enough
to represent the "nested multi-splitter" concept which KDDW uses.
After each item insertion/deletion/resize, the separators are regenerated. They
are essentially dumb now.
TODO:
- Separators are drawn, but are not interactive yet
- There's 5 tests failing
- LayoutSaver scalling functionality
Fixes a case where the floating window wouldn't disappear.
This is deep in Qt. Got it down to a minimal test-case and reported it.
Probably won't get fixed ever.
Same for restore.
This is better API as LayoutSaver shouldn't be concerned about
QSettings. It also assumed the user only had a single layout, which
is normally not the case.
And finally, storing escaped json in .ini files is not very elegant.
Bug was happening when calling close() an closed dock widget, it
would then save the position of the invisible window. Next time it
was open it would appear in a bogus location. 0,0 in my case.
Our RAII class that ensures that each test leaves 0 top-levels behind
was being initialized with somthing bigger than 0 since the
rectForDrop() test wasn't doing proper cleanup.
Not sure why only repro with 5.9, but it's correct now.
To repro:
- stack 3 dock widgets vertically
- close the top one
- close the top one
The remaining one should now fill the whole window but it wasn't.
Culprit was the code that makes sure that when a dock is closed that
the adjacent ones get to share their space
We don't want to count the size of separators that are following
others, but we might be in the middle of an operation that will
change which separators are following, like when restoring a placeholder.
So query the actual separators that will follow.
Fixes fuzzer 8.json and 2.json
So the layout can grow first and not complain there's not enough
space.
Fixes fuzzer test-case 3.json.
The warning was: "Constraints not honoured" in Item::onLayoutRequest()
Frame::updateTitleBarVisibility() was bailing out early. That
guard looks like some leftover, m_dropArea isn't even dereferenced
there, so just remove the guard.