Commit Graph

944 Commits

Author SHA1 Message Date
Sergio Martins
3ef2cef7b7 Allow to configure separator thickness 2019-08-06 13:56:57 +01:00
Sergio Martins
e206b9f0f8 Fix layout margins, got lost with a refactoring 2019-08-06 13:46:12 +01:00
Sergio Martins
eafc00657b Separator: Decouple the QWidget dependency
There's no Separator and SeparatorWidget. The former only with
state/logic. To be reused by QtQuick.
2019-08-06 13:32:06 +01:00
Sergio Martins
8742da76ae DockWidgetBase: Move layouting code into DockWidget.cpp
We don't want QWidget related code in the base class, to be
shared with QML
2019-08-06 12:58:07 +01:00
Sergio Martins
464ef4fd93 Move widget specific stuff from DockWidgetBase to DockWidget 2019-08-06 00:36:00 +01:00
Sergio Martins
8f05c3fa72 cmake: include_directories-- 2019-08-05 23:55:19 +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
39ba3cdf2d FloatingWindow: Move the close logic into the logic class 2019-08-05 22:07:03 +01:00
Sergio Martins
570de60981 FloatingWindow: Move layouting code to FloatingWindowWindow
Our "data" class shouldn't worry about appearence
2019-08-05 22:01:49 +01:00
Sergio Martins
7a06126194 examples: Add a custom title bar example 2019-08-05 15:54:09 +01:00
Sergio Martins
1f78385ccb TitleBar: Don't make it pure virtual
Those pure virtuals are only for tests
2019-08-05 15:24:06 +01:00
Sergio Martins
2ce50c01ef Remove wrong assert, the variable is set to the default 2019-08-05 15:23:39 +01:00
Sergio Martins
663e06e5b5 Export FrameworkWidgetFactory 2019-08-05 15:23:25 +01:00
Sergio Martins
ea37783d04 Try to fix windows build 2019-08-05 13:02:18 +01:00
Sergio Martins
33aa76164a Fix linux build 2019-08-05 12:57:21 +01:00
Sergio Martins
da31a72194 Fix Windows build 2019-08-05 12:48:21 +01:00
Sergio Martins
ae7934dd47 Abstract FloatingWindow too, introducing FloatingWindowWidget 2019-08-05 02:41:34 +01:00
Sergio Martins
d8c689316d Moved SeparatorWidget into widgets/
It's now abstracted by the FrameworkWidgetFactory, allowing
the user to provide his own
2019-08-05 02:13:42 +01:00
Sergio Martins
a17465158d Introduce FrameworkWidgetFactory
The framework uses a few QWidgets (FrameWidget, TabbarWidget, TabWidget
TitleBarWidget). This factory allows the user to provide his own,
to achieve different appearence.
2019-08-05 01:35:42 +01:00
Sergio Martins
0f579d8f5e TabWidget: Separate GUI from state 2019-08-05 00:24:02 +01:00
Sergio Martins
bddd059ce9 TabBar: Split logic from GUI
Will make it easier for the users to subclass TabBar and provide an alternative.
Also easier to make the QtQuick port.
2019-08-04 23:51:43 +01:00
Sergio Martins
b347e0e53f Abstract Frame.cpp into FrameWidget
Anything GUI specific should go to FrameWidget, so the user
can change GUI aspects without impacting the sensitive logic.
2019-08-04 23:10:12 +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
603de72c24 Remove unused TitleBar ctor 2019-08-04 20:07:18 +01:00
Sergio Martins
1e3782b73b Add DockWidget::tabWidget() getter 2019-08-04 19:15:37 +01:00
Sergio Martins
b487a31edc Use 5px as top margin 2019-08-03 16:06:48 +01:00
Sergio Martins
b2a3e974fa Initialize the layout's min size
Fixes a unit-test on platform offscreen
2019-08-03 16:06:23 +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
5915c2b70f When trying to drag a TabWidget don't allow to click everywhere
We can only click the background next to the tabs
2019-08-03 12:42:07 +01:00
Sergio Martins
ea9bbe324c Allow to drag a tabwidget by it's background
So you can click next to the tabs instead of the title bar
2019-08-03 12:20:23 +01:00
Sergio Martins
0cac8f7b7c Fix some clazy warnings 2019-08-03 12:15:14 +01:00
Sergio Martins
2916495f7a Update the FloatingWindows title when the frame's tab changes
When we have a single frame with multiple dock widgets, the window's
title and icon should be of the current dock widget
2019-08-03 12:07:42 +01:00
Sergio Martins
29c42443ef Add a missing setIcon call to FloatingWindow 2019-08-03 12:01:12 +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
0e6b3454cd Add AnchorGroup::adjacentAnchors() 2019-08-02 23:18:41 +01:00
Sergio Martins
16e2141ae5 Remove unneeded debug 2019-08-02 22:28:06 +01:00
Sergio Martins
454f3d1b48 Remove unneeded debug 2019-08-02 22:21:42 +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
f69b17ba7f print debug when the assert hits 2019-08-02 09:43:06 +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
26dc975e11 fix build 2019-08-02 08:39:43 +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
4cf50eeb8c Simplify MultiSplitterLayout::ensureEnoughContentsSize
It wasn't even accurate, as it was giving too much size.
Also removed the concept of 'extraUselessSpace". This was from
the time where FloatingWindow was itself a MultiSplitterLayout,
so had to make space for the TitleBar.
2019-08-01 18:23:46 +01:00
Sergio Martins
7a007c15c6 readability++ 2019-08-01 17:27:19 +01:00
Sergio Martins
2e21dd484c Minor readability improvement 2019-08-01 17:25:44 +01:00