Commit Graph

266 Commits

Author SHA1 Message Date
Sergio Martins
550d84ab11 Rename for readability 2020-05-10 22:26:40 +01:00
Sergio Martins
f6f70f26e4 Item: Also pass the neighbour shrink strategy all along
So we can choose another one when restoring a child
2020-05-10 22:17:59 +01:00
Sergio Martins
c4df3600af tst_docks|fuzzer: Use offscreen QPA by default too 2020-05-10 21:26:52 +01:00
Sergio Martins
7c85c1eb0f Resize the layout after restoring
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
2020-05-09 00:46:30 +01:00
Sergio Martins
addf436fd0 LayoutSaver: Don't load old serialization versions 2020-05-08 19:30:41 +01:00
Sergio Martins
ff6260a4dc tests: Add a failling test tst_invalidLayoutAfterRestore
And a JSON file that makes it fail
2020-05-08 18:40:23 +01:00
Sergio Martins
3c1ab0126d Item: Clear and honour a bunch of TODOs 2020-05-07 18:49:00 +01:00
Sergio Martins
0df9943aa5 Fix fuzzer test 11.json and other tests that worked by luck
mapFrom/toRoot were wrong
2020-05-07 16:30:45 +01:00
Sergio Martins
535a0c943c Remove some cruft, bunch of unused methods from old layouting engine 2020-05-04 23:37:04 +01:00
Sergio Martins
e298667351 Remove dead code about static separators
Before we had separators on the left,top,bottom,right margins
with 0 width. Now we don't have this concept anymore
2020-05-04 14:28:59 +01:00
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
86d1a52bbf Fix unit-test
Was leaving window leftovers behind.
Delete them.
2020-05-03 16:41:52 +01:00
Colin Ogilvie
43a25ef93b Add test for foating action 2020-04-30 16:56:13 +01:00
Sergio Martins
225aa6a098 Add unit-test for DockWidget::raise()
and make it pass on offscreen platform too, as that QPA plugin
fails to keep z-order between order.
2020-03-24 22:36:21 +00:00
Sergio Martins
afb3edfd1d unit-tests++ 2020-03-24 13:33:51 +00:00
Sergio Martins
fc63f843b7 Workaround QTBUG-83030
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.
2020-03-24 10:58:31 +00:00
Sergio Martins
cc1e1eaa51 Don't flicker when showing a floating dock widget
Create the FloatingWindow directly, instead of creating the DockWidget
then reparenting it
2020-03-07 21:15:44 +00:00
Sergio Martins
eabcdfb945 Add unit-test for affinity 2020-03-01 15:03:29 +00:00
Sergio Martins
63e662323f Added unit-test for Flag_DoubleClickMaximizes 2020-02-27 15:13:01 +00:00
Sergio Martins
6fb0694aab LayoutSaver: Replace saveToDisk() with saveToFile(jsonFilename)
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.
2020-02-24 15:10:12 +00:00
Sergio Martins
579b222418 Make AddingOption_StartHidden also work for tabs
You can now pass that option to DockWidget::addDockWidgetAsTab().
2020-02-19 16:36:50 +00:00
Sergio Martins
aded290573 Don't save last position if the window was hidden already
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.
2020-02-06 15:01:58 +00:00
Allen Winter
df692686e7 various - update copyright year 2020-01-07 11:36:56 -05:00
Sergio Martins
2ff2b78f5a Fix unit-tests on Windows with Qt 5.9
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.
2020-01-04 22:24:11 +00:00
Sergio Martins
6be2490c08 tests: When cleanup fails print the top-levels that we compared to
Since qApp->topLevels() contains buttons which will be deleted later
2020-01-04 21:15:39 +00:00
Sergio Martins
f37ecc0765 tests: Remove test with hardcoded values
It's flaky as the min sizes are varying with Qt versions. Also what
it tests is already tested in previous tests and elsewhere.
2020-01-04 18:33:43 +00:00
Sergio Martins
3b20f99092 tests: Add some missing window cleanup checks 2020-01-04 18:27:20 +00:00
Sergio Martins
9f5c7b5e6a tests: Use fusion style on all platforms
To make the tests more robust, as some widgets min size will
vary
2020-01-04 18:19:26 +00:00
Sergio Martins
e5df8db045 tests: Add some tests for double close 2019-12-29 18:29:27 +00:00
Sergio Martins
6be6aee56a Fix dock widgets not filling their complete available space
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
2019-12-23 14:28:40 +00:00
Sergio Martins
7452520662 Add DockRegistry::dockWidgetForGuest()
So you can find out the dock widget which hosts a widget
2019-12-20 10:57:05 +00: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
Sergio Martins
27cae066a6 Fix Anchor::cumulativeMinLength
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
2019-10-17 13:30:31 +01:00
Sergio Martins
92bbe4d4f7 Remove a dock widget from the layout before adding as tab
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()
2019-10-15 12:51:49 +01:00
Sergio Martins
a2e610ee4b tests: share waitForEvent() and waitForDeleted() 2019-10-11 11:38:21 +01:00
Sergio Martins
83625bdda3 tests: Move the qDebug filter to Testing.h
So it can be shared with the fuzzer
2019-10-11 08:46:51 +01:00
Sergio Martins
ac313c5a24 Don't save floating geometry on clear()
clear() shouldn't save anything.
Fixes floating dockwidgets not having proper geometry when shown
after clear() was called.
2019-10-08 14:59:31 +01:00
Sergio Martins
58e90bd7c4 Make MainWindow_None the default, instead of MainWindow_HasCentralFrame
Central Frame is the old Qt way. With KDDockWidgets everwhere
is fair game to dock and undock.
2019-10-07 14:02:30 +01:00
Sergio Martins
a0d05b4e2b Move Frame::Options enum to KDDockWidgets.h
So we can forward declare Frame and not include private headers
in FrameworkWidgetFactory.h
2019-10-07 13:43:48 +01:00
Sergio Martins
21579f2743 Minor method renames 2019-10-07 00:16:16 +01:00
Sergio Martins
c5149ab13c Fix title bar being visible with Flag_HideTitleBarWhenTabsVisible
Frame::updateTitleBarVisibility() was bailing out early. That
guard looks like some leftover, m_dropArea isn't even dereferenced
there, so just remove the guard.
2019-09-30 11:00:38 +01:00
Sergio Martins
8df3eddd9b Fix crash when trying to drag a single tab
and the tab was in a floating window and we were using "TabsAlwaysVisible"
2019-09-12 17:22:29 +01:00
Sergio Martins
254dde64c7 Tests++ 2019-09-12 15:58:17 +01:00
Sergio Martins
9ef006bce4 tests++ 2019-09-12 15:50:11 +01:00
Sergio Martins
370780cf22 Don't run the sanity checks during a restore
During a restore the layout is in an intermediate state, so we're
not suppose to do such tight checks.
2019-09-10 19:41:39 +01:00
Sergio Martins
abbc79f0e0 Progress with the QtQuick port 2019-09-07 16:20:22 +01:00
Sergio Martins
76640d16b3 Fix support static separators with 0 thickness 2019-09-02 11:26:57 +01:00
Sergio Martins
9f7969bfc3 Tests now pass with static anchor thickness > 2
Still need to fix with =0
2019-09-02 11:07:58 +01:00
Sergio Martins
8cb34e4d65 tests: Fix tst_rectForDrop() with variable static anchor thickness 2019-09-02 10:56:48 +01:00