Commit Graph

309 Commits

Author SHA1 Message Date
Sergio Martins
25dd149475 Add Widget::mapToGlobal() 2020-06-13 19:09:44 +01:00
Sergio Martins
163b194398 Fix clang build, mostly shadowing warnings 2020-06-11 17:00:54 +01:00
Sergio Martins
86e58dd8a7 Merge MultiSplitterLayout into MultiSplitter
No need to have two. It's a leftover from the old layouting engine
2020-06-11 16:34:28 +01:00
Sergio Martins
7f9d160658 Also honour QSizePolicy::Maximum
It's yet another way to say you want a max size
2020-06-07 20:14:50 +01:00
Sergio Martins
daa220d513 tests: let the widget receive a size hint 2020-06-07 20:01:37 +01:00
Sergio Martins
d5797a3aea Honour QSizePolicy::Fixed too
Some widgets, for example QPushButton, instead of having an explicit max size,
they communicate the need for a max size through their size policy
2020-06-07 19:53:06 +01:00
Sergio Martins
dabfeeaf3b Honour max-size when floating a window 2020-06-05 15:35:55 +01:00
Sergio Martins
296889cace Move TabWidget usage to FrameWidget
Frame is abstract and doesn't care about such implementation details.
QQuick will role out their own QTabWidget equivalent. No need to
abstract tab widget too, it's overkill.
2020-06-04 09:57:59 +01:00
Sergio Martins
ecfa43f801 Decouple TabWidget from Frame
TabWidget is now an implementation detail of FrameWidget.
QQuick will roll their own stuff with similar api, but no need to
abstract QTabWidget and QTabBar
2020-06-03 22:18:44 +01:00
Sergio Martins
0a75d89848 Add Frame::detachTab()
The tab widget will be an implementation detail of FrameWidget and
not accessed by anyone
2020-06-03 21:18:38 +01:00
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
a086713bb6 Implement FrameWidget::maxSizeHint() 2020-05-29 08:11:42 +01:00
Sergio Martins
6797d291b6 Propagate max-size from the guest widget to DockWidget
Next step is propagating from DockWidget->Frame
2020-05-28 18:40:55 +01:00
Sergio Martins
4e3197388e Add a failing TestDocks::tst_maxSizePropagates 2020-05-28 17:47:57 +01:00
Sergio Martins
d07f715ed7 updateTitleBarVisibility after deserializing
Fixes floating window having two title bars
2020-05-26 21:53:51 +01:00
Sergio Martins
87c7a8ad65 Add unit-test for the previous commit 2020-05-26 20:17:37 +01:00
Sergio Martins
7634438f6c Add unit-test to previous commit 2020-05-25 23:30:31 +01:00
Sergio Martins
e08a7a6725 Fix tst_lastFloatingPositionIsRestored when there's a frame
Otherwise only passes on offscreen qpa which has no frame
2020-05-25 22:19:05 +01:00
Sergio Martins
63c90875aa example: Add example of docking main window into main window 2020-05-25 21:45:21 +01:00
Sergio Martins
de09d5532f Fix DropArea::numFrames()
Was counting with placeholder items too. This should fix title bars
being wrong in some cases.
2020-05-25 20:12:29 +01:00
Sergio Martins
944138273f Tests: stabilize tst_embeddedMainWindow
Going 50px into the window was too short and didn't reach the embedded
window to show the indicators.

Also, it's the inner indicator we want, the other isn't visible as the
window is single frame
2020-05-25 20:11:01 +01:00
Sergio Martins
d94263fce5 Allow each dock widget and main window to support multiple affinities 2020-05-25 14:14:17 +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
c31edd0cd8 Remove a stray qDebug 2020-05-24 18:30:56 +01:00
Sergio Martins
16aac70510 Make MultiSplitter inherit from Layouting::Widget too
Since it's the host widget.
Fixes the Widget wrapper leaking. And no need for so much boiler-plate
2020-05-24 18:25:19 +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
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
2527b39368 Moved the multisplitter wrapper outside of multisplitter/
As it depends on kddw framework, while multisplitter/ is the
agnostic layouting engine
2020-05-23 17:01:20 +01:00
Sergio Martins
71c7a7c9a9 Move more ItemContainer members to private 2020-05-23 16:46:43 +01:00
Sergio Martins
6d44362991 DockWidget::setFloating(true): restore to previous floating position
When floating a dock widget we restore it to the last known floating
position now
2020-05-22 11:12:12 +01:00
Sergio Martins
ce7c913f8c Move the last floating geometry 1 level up
So it's not overwritten.
Added a unit-test for testing that floating geometry doesn't break
2020-05-21 19:32:18 +01:00
Sergio Martins
b4526b007c Make LastPositions::lastPosition private
Need to control how the setters are messing with it, to add more
of them
2020-05-21 18:56:44 +01:00
Sergio Martins
9779b8edc3 Deal in terms of LastPositions instead of the individual position
Just a refactoring to add more encapsulation
2020-05-21 17:43:51 +01:00
Sergio Martins
50934ae56d Use a shared_ptr for Position, so we can pass LastPositions by value 2020-05-21 17:19:54 +01:00
Sergio Martins
f260a76f8b Rename LastPosition to Position
so we can have a list of them, the dock widget might have been
in several main windows
2020-05-21 14:49:49 +01:00
Sergio Martins
6de5860e9a Don't allow to drop to itself when having mainwindow inside dock widget 2020-05-20 16:33:48 +01:00
Sergio Martins
af22e3e12d Fix tst_raise on XCB 2020-05-19 13:44:01 +01:00
Sergio Martins
9e198917f0 Try to recover from loading an invalid layout 2020-05-19 12:35:33 +01:00
Sergio Martins
4647814aae Fix tests with Qt 5.9
QTabWidget is a bit flaky and changes min width at unexpected times.
Which is fine but we can't compare against the expected min size
since it changes. So just check sanity of the restored layout
2020-05-17 17:12:31 +01:00
Sergio Martins
d44a6f78b8 Fix build with older Qt 2020-05-14 21:10:46 +01:00
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