Commit Graph

247 Commits

Author SHA1 Message Date
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
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
Sergio Martins
3f2f515553 Comment tests that are still failing 2019-08-01 16:56:30 +01:00
Sergio Martins
9acfa2b9bf Add a failing test 2019-08-01 15:06:42 +01:00
Sergio Martins
1ac027c201 Don't show the DockWidget that's about to be restored 2019-08-01 10:58:37 +01:00
Sergio Martins
9fd4df484d Add test for DockWidgetFactoryFunc 2019-08-01 10:50:40 +01:00
Sergio Martins
990a98d7d9 Fix tests
Some QToolButtons are deleted later
2019-07-30 22:52:57 +01:00
Sergio Martins
cdff9b3eaa Some renaming 2019-07-30 16:59:29 +01:00
Sergio Martins
9979696567 Fix being able to drag a FloatingWindow when dragging its body
We should only be able to drag via title bars, not widget
background.

This separates the concept of Draggable and Window, previously
they were mixed a bit. The draggable is something you drag,
usually a TitleBar, a Tab, or if using native window decorations
then FloatingWindow is also a draggable. Then, for each draggable
there's the actual window being dragged, that's always a FloatingWindow.

We should grab the mouse of the draggable.
2019-07-30 12:50:42 +01:00
Sergio Martins
77a61aed23 Preserve Anchor position percentage after restore 2019-07-29 21:18:29 +01:00
Sergio Martins
7bcafb6ee3 Preserve anchor position percentage when restoring a maximized window 2019-07-29 20:31:51 +01:00
Sergio Martins
90cbd9731a Fix anchors being out of bounds when consoming another multi splitter
dropping a multi splitter into another one wasn't honouring the bounds
of the donor's inner anchors
2019-07-29 18:54:09 +01:00
Sergio Martins
158c6157b5 Don't resize horizontal anchors when resizing window width
Similar for height
2019-07-29 18:53:29 +01:00
Sergio Martins
fd0b594331 Save the geometry of the actual top-level window
In case we have a main window embedded in another widget
2019-07-27 18:56:29 +01:00
Sergio Martins
1a8a409f6f Fix some out of bounds positionings
When calculating the cumulative min length some anchor thicknesses
were being accounted for because we had cleared the placeholders
2019-07-26 14:21:57 +01:00
Sergio Martins
d0be94e2dd Also update Item's minSize before restoring placeholder 2019-07-26 11:52:21 +01:00
Sergio Martins
4d9424e330 tests++ 2019-07-26 10:50:49 +01:00
Sergio Martins
f5e72e7bed Fix available space calculation when there's placeholders
When layout is empty we don't need to account for the space
occupied by the new anchor. But neither when all the items
are placeholders
2019-07-25 23:15:12 +01:00
Sergio Martins
e4d1c92b8a Simplify test, this is enough to repro 2019-07-25 21:23:27 +01:00
Sergio Martins
d13ae5f03a Add a failing test 2019-07-25 19:32:07 +01:00
Sergio Martins
e58cab181a Don't crash when restoring after a resize 2019-07-25 18:20:05 +01:00
Sergio Martins
6ca50aecc7 Update the frame geometry when restoring the item 2019-07-25 17:17:27 +01:00
Sergio Martins
c645b8d9fa Fix test that was failing on XCB and Windows but not on offscreen
Not sure why it didn't fail
2019-07-25 14:41:54 +01:00
Sergio Martins
5befd7a3d5 restore: Also restore the ITem's min-size 2019-07-25 10:02:14 +01:00
Sergio Martins
a5ee3cec27 Before closing really close all the dock widgets
The user app was able to ignore the QCloseEvent and the widget
wouldn't close, which would then mean it was deleted by it's parent
Frame during restore
2019-07-24 23:10:55 +01:00