Commit Graph

11 Commits

Author SHA1 Message Date
Sergio Martins
0595448bba Replace Anchor with Separator
We don't have the concept of Anchors anymore. Code is now simpler
2020-05-04 13:10:38 +01:00
Sergio Martins
97c1ca30fd Layouting engine rewrite
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
2020-05-04 00:02:03 +01:00
Sergio Martins
9904d847f2 LayoutSaver now can save/restore a sub-set of windows
Each subset is identified by its "affinity name".
See DockWidget/MainWindow setAffinityName property.

Patch contributed by Andras Mantia, I've changed it to deal in
terms of affinity names instead of unique names.
2020-03-01 14:25:31 +00:00
Sergio Martins
ee786f57c5 LayoutSaver: Fix rounding errors when doing a relative restore
After a restore with relative sizes the items might not be on a pixel
perfect position regarding to their anchors. Make sure they are after
the restore is complete.
2020-02-25 23:24:39 +00:00
Sergio Martins
3f732e91a7 Minor refactoring 2020-02-25 22:53:28 +00:00
Sergio Martins
b80a795968 Improve comments on this function 2020-01-24 10:02:22 +00:00
Sergio Martins
0003b508d6 Bound interval when adding the widget
rectForDrop() doesn't know about the anchors bounds, so we need to
adjust the interval after. Fixes fuzzer testcase 16
2020-01-22 22:49:45 +00:00
Allen Winter
df692686e7 various - update copyright year 2020-01-07 11:36:56 -05:00
Sergio Martins
83f6bb8daf Remove some sanity checks, no longer needed
Silenced a false-positive warning about anchor visibility.
It was invisible because we're within a main window show()

It will be checked by the unit-tests and fuzzer anyway. No need to
do it in production.
2019-10-22 15:28:50 +01:00
Sergio Martins
38949fac2a Fix build without find_package()
Some of our projects have kddockwidgets directly in their build
2019-10-21 14:30:04 +01:00
Sergio Martins
787f7802be Move the private code into a private/ folder
It's nice to have a similar include hierarchy at build time and install
time.

It also makes things more explicit
2019-10-20 19:24:54 +01:00