Commit Graph

379 Commits

Author SHA1 Message Date
Sergio Martins
8cb34e4d65 tests: Fix tst_rectForDrop() with variable static anchor thickness 2019-09-02 10:56:48 +01:00
Sergio Martins
5caca65843 Fix test that didn't support static anchor thickness != 1 2019-09-02 10:52:03 +01:00
Sergio Martins
7797599b5d Fix unit-tests when separator thickness is even 2019-09-01 19:04:37 +01:00
Sergio Martins
30135acbd0 tests: Remove hardcoded anchor thicknesses 2019-09-01 15:03:04 +01:00
Sergio Martins
46a5a580bc Add LayoutSaver::restoredDockWidgets()
Implemented as a property it's better that the LayoutSaver
doesn't carry state about this. Then we would need to remove dock
widgets from the list if they are deleted. Also not a important
enough feature to be on the DockWidget public interface.
2019-08-28 17:56:18 +01:00
Sergio Martins
f0078c3649 Fix dragging window by title bar when using document mode
When using document mode the click goes to the tab bar, not the
tab widget
2019-08-28 17:05:45 +01:00
Sergio Martins
59cdadf386 Add DockWidgetBase::titleBar() 2019-08-24 22:55:06 +01:00
Sergio Martins
9e9ca66382 Call ensureAnchorsBounded() directly in setSize()
No need for it to be scattered in random places.
Also, don't warn in Anchor::setPosition() if we're in the middle
of a resize, ensureAnchorsBounded() will be called soon.
2019-08-20 18:19:20 +01:00
Sergio Martins
ecf1b61f22 Respond immediatley to min size changes
instead of waiting for LayoutRequests from the main window
which can be async.
2019-08-20 17:48:55 +01:00
Sergio Martins
7a91fb5310 tests: Add more checkSanity() 2019-08-19 22:50:27 +01:00
Sergio Martins
9f544975f1 Support existing widget's minSize changing
previously we only honoured the min size of when they were
added to the layout
2019-08-19 19:44:51 +01:00
Sergio Martins
dd58836ddf Fix another case of out of bounds anchor position
Happens because rectForDrop() is returning the rect without considering
the widget that we're adding, so doesn't respect the bounds.

Let's just ignore the out of bounds warning. ensureAnchorsBounded()
is ran at the end anyway so we're fine.
2019-08-19 19:26:54 +01:00
Sergio Martins
c6a8b236af Update the item's minimum size when restoring a placeholder 2019-08-13 14:08:08 +01:00
Sergio Martins
c1ea98825e Improve includes 2019-08-12 16:41:00 +01:00
Sergio Martins
cace480ff2 Add failing unit-test 2019-08-12 14:51:46 +01:00
Sergio Martins
776a0f78ed Rename contentsSize to size
When MultiSplitterLayout was a widget it made sence to have
a different name, but now anymore
2019-08-12 11:56:37 +01:00
Sergio Martins
3385b6c15c After restoring a placeholder we need to ensure all anchors are bounded
We only ensure the ones next to our item are bounded, but there can be
indirect ones that were holding items that now must shrink
2019-08-12 11:29:45 +01:00
Sergio Martins
b8de3aa21f TitleBar: Allow to makeWindow() even if it's not visible
The MainWindow can be hidden still.
Anyway, this won't be called if really invisible, the assert
is a bit tight.
2019-08-08 22:51:33 +01:00
Sergio Martins
74997d35c5 Add test that we can add to an hidden window 2019-08-08 22:45:33 +01:00
Sergio Martins
990e487fed rename name() to uniqueName() for readability 2019-08-08 22:30:29 +01:00
Sergio Martins
17b3048aeb cmake: Rename target to kddockwidgets instead of docks 2019-08-08 16:03:59 +01:00
Sergio Martins
daef0c470e Try to not expose the tab bar
It's an implementation detail of FrameWidget. Makes porting
to QtQuick easier
2019-08-08 10:08:38 +01:00
Sergio Martins
89757def76 Abstract TabWidget away from QtWidgets, so can be used for QtQuick 2019-08-08 00:41:48 +01:00
Sergio Martins
0ba3371c6c Move layouting code from Frame to FrameWidget 2019-08-07 23:53:10 +01:00
Sergio Martins
70db3fe2a3 tests: Don't create frame directly 2019-08-07 23:11:34 +01:00
Sergio Martins
93303035c4 Drag the QWindow instead of the top-level QWidget
So it works for QtQuick too
2019-08-07 14:01:29 +01:00
Sergio Martins
cb7ecb76e4 Rename the MultiSplitterWidget files too 2019-08-06 22:19:00 +01:00
Sergio Martins
01c4bddcc3 Rename MultiSplitterWidget to MultiSplitter
Since now we're suffixing with Widget the QtWidget specific classes,
not this one that will be shared with QtQuick
2019-08-06 22:12:15 +01:00
Sergio Martins
5613030fd3 Revert "Remove DOCKS_EXPORT_FOR_UNIT_TESTS to simplify things
Maybe let's keep it, since it's on very core classes that
users shouldn't change

This reverts commit db4167dd1f.
2019-08-06 22:08:00 +01:00
Sergio Martins
db4167dd1f Remove DOCKS_EXPORT_FOR_UNIT_TESTS to simplify things
And also to give more power to the user
2019-08-06 22:05:30 +01:00
Sergio Martins
49bd0b42be Add unit-test for dragging by tab widget directly 2019-08-06 21:12:34 +01:00
Sergio Martins
c78180f135 Minor refactoring 2019-08-06 20:51:28 +01:00
Sergio Martins
fc90d1e506 Move more code into tests/utils.cpp 2019-08-06 20:45:16 +01:00
Sergio Martins
1c7d0c0059 tests: refactor drag() to support dragging the TabWidget directly 2019-08-06 20:22:20 +01:00
Sergio Martins
6fe115e3fc Tests for Flag_HideTitleBarWhenTabsVisible 2019-08-06 20:02:15 +01:00
Sergio Martins
fb837b7713 Move DockWidget.cpp into widgets/
As it's specific to QtWidgets. It's mostly empty now
and inheriting from DockWidgetBase, but we'll move a few stuff.
2019-08-05 23:35:44 +01:00
Sergio Martins
ea37783d04 Try to fix windows build 2019-08-05 13:02:18 +01:00
Sergio Martins
ee023cb5ac Move TitleBarWidget into widgets/ 2019-08-04 21:56:08 +01:00
Sergio Martins
3035d387a5 TitleBar: Introduce TitleBarWidget to separate logic/state from GUI
TitleBar has the state, while TitleBarWidget has the appearence.
This makes it easier for the user to specify his own TitleBar's,
by inheriting from TitleBar.

Will also make the QtQuick support easier.
2019-08-04 21:50:28 +01:00
Sergio Martins
fe49790170 MainWindow: Put the central widget into a layout
So we can add margins
2019-08-03 15:41:39 +01:00
Sergio Martins
0cac8f7b7c Fix some clazy warnings 2019-08-03 12:15:14 +01:00
Sergio Martins
cb7d1086b9 tests: Don't use QStringLiteral or any fancy Qt restrictions
It's very verbose and its preformance benefits aren't important
for the tests
2019-08-03 11:55:27 +01:00
Sergio Martins
369703a0bd tests: Remove a bunch of qobject_casts<FloatingWindow*>
By adding DockWidget::floatingWindow()
2019-08-03 11:22:06 +01:00
Sergio Martins
ae7ea032d0 Get rid of actualTitleBar() hack and simplify logic
Instead of having both FloatingWindow::updateTitleBarVisibility()
and Frame::updateTitleBarVisibility() have logic, simplify it:

- FloatingWindow's title bar is always visible
- Frame's title bar is visible if in a nested FloatingWindow
or in a MainWindow
2019-08-03 11:11:49 +01:00
Sergio Martins
4613fa20f4 Resize the adjacent anchors when adding a widget, if needed
Means that if adding to left/right then we must ensure the top/left
anchor of the group is positioned in a way that respects the widget's
minimum height. Previously we were only honouring width.

And vice-versa for the other orientation, s/left/top,s/right/bottom
2019-08-02 23:55:08 +01:00
Sergio Martins
76a5c79ca2 Add a sanity check 2019-08-02 20:11:56 +01:00
Sergio Martins
d9c6452d88 Relax assert, that condition can happen on hover and it's fine 2019-08-02 19:34:17 +01:00
Sergio Martins
51f76d4986 When docking to left/right also adjust height and vice-versa
Previously we were only resizing one direction
2019-08-02 09:22:29 +01:00
Sergio Martins
089f9361c1 Remove DockWidget::titleBar, as it's not needed
DockWidget's are either floating or not. If floating they have the
title bar from FloatingWindow, otherwise from Frame
2019-08-01 23:44:25 +01:00
Sergio Martins
2e21dd484c Minor readability improvement 2019-08-01 17:25:44 +01:00