Commit Graph

80 Commits

Author SHA1 Message Date
Sergio Martins
3cb6c2b8d0 Add DockWidget::open()
Show/hide/visibility is being deprecated
2022-09-10 12:10:25 +01:00
Sergio Martins
b5a9c03c21 Don't handle QEvent::Hide anymore
Update the buttons in DockWidget::setIsOpen() instead.
This makes the controllers self-contained and not depending
on the "view technology". Other frameworks might not even
have the concept of show/hidden events
2022-09-10 11:37:32 +01:00
Sergio Martins
3a280ae377 Minor indirection removal (DockWidget::Private::onDockWidgetShown()) 2022-09-10 11:30:18 +01:00
Sergio Martins
29be2ae819 Remove DockWidget::hidden() and shown() signals
Visibility isn't useful as a concept, since non current tabs
are also hidden. Instead, use DockWidget::isOpen()
2022-09-10 11:23:39 +01:00
Sergio Martins
764385de9f refactor: DockWidget::isOpen() now keeps its state in the controller
No longer tied to QtWidget visibility. This will make it easier to
make new frontends.
2022-09-09 19:51:25 +01:00
Sergio Martins
1998800883 Remove unneeded "spontaneous" argument from onShown/hidden 2022-08-21 22:55:45 +01:00
Sergio Martins
c8b16c9712 Remove unneeded Group::onDockWidgetShown 2022-08-21 22:09:06 +01:00
Sergio Martins
21d7d220c5 Remove legacy Group::onDockWidgetHidden code which is now unneeded
Tests pass without it, so let's simplify.
2022-08-21 17:11:06 +01:00
Sergio Martins
763ad1ae6b Wrapper views now also get a dummy controller
Now we can finally make all setVisible/isVisible calls go
through the controller
2022-08-20 19:24:21 +01:00
Sergio Martins
be2c297fa9 Fix list of tabs not being updated when dock widget closed
When closing, we need to remove from the TabBar controller.

QtWidgets tests no pass again.
2022-08-15 19:55:01 +01:00
Sergio Martins
d8189e3e03 .clang-format: wrap at column 100 2022-08-05 16:49:00 +01:00
Sergio Martins
e4b2d37f96 Rename "addWidget" to "addTab" 2022-07-31 23:03:16 +01:00
Sergio Martins
fb701e8307 Move DockWidget::parentViewChanged() signal to base class
So it matches the setter, which was already in the base class
2022-07-22 09:54:18 +01:00
Sergio Martins
1097908882 Override DockWidget::setParentView() instead of relying on QEvent
So it works with non-Qt frontends too.
2022-07-22 09:36:20 +01:00
Sergio Martins
5c26aaa9cd Port some raw QObject::setParent() calls 2022-07-21 22:59:27 +01:00
Sergio Martins
f288d953fc Add Platform::applicationName()
so controllers don't access qGuiApp directly
2022-07-03 19:55:26 +01:00
Sergio Martins
f1fb3f1eac Remove unneeded event filter from DockWidget.cpp
It has been ported already
2022-07-03 19:47:26 +01:00
Sergio Martins
aff9806ab1 Port away from using event filter in DockWidget.cpp
Platform now abstract the emittion of window activation/deactivation
2022-06-28 18:36:10 +01:00
Sergio Martins
0cd515679f Don't handle ParentChange event directly, use the signal instead
This removes some duplicated code and decouples from QObject a bit
more
2022-06-28 17:24:03 +01:00
Sergio Martins
10c918b93c Use View instead of ViewWrapper in the api
The latter will be an implementation detail soon
2022-06-24 00:10:50 +01:00
Sergio Martins
ae5cf1d723 More renaming of "frame" to "group" 2022-06-23 16:01:43 +01:00
Waqar Ahmed
4ba58ac1be Add DockWidget::aboutToDelete
Relying on QObject::destroyed might not be a good idea, fixes the
following ASAN issue:

```
SideBar.cpp:80:22: runtime error: downcast of address 0x6040005c8b90
which does not point to an object of type 'DockWidget'
0x6040005c8b90: note: object is of type 'QObject'
 00 00 00 00  88 64 e7 43 3f 7f 00 00  a0 ff 0e 00 80 60 00 00
70 81 0c 00 c0 60 00 00  01 be be be
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'QObject'
```
2022-06-22 19:16:56 +05:00
Sergio Martins
cc918c5195 More "frame" to "group" renaming 2022-06-22 13:42:22 +01:00
Sergio Martins
bc767cefac Rename asFrameController to asGroupController 2022-06-21 17:32:38 +01:00
Sergio Martins
0aec6dfdb1 Rename more frame variables to group 2022-06-21 17:31:28 +01:00
Sergio Martins
9469273c7a Rename "frame" variables to "group" 2022-06-21 17:12:11 +01:00
Sergio Martins
fe7a8d450c Rename Frame class to Group 2022-06-21 16:34:20 +01:00
Sergio Martins
73d627554a Remove Frame.h/cpp to Group.h/cpp
It's a better name.
Files only for now. Contents will come in a followup.
2022-06-21 08:51:52 +01:00
Sergio Martins
f2ddbd2cc3 Added KDDockWidgets::InitialVisibilityOption::PreserveCurrentTab
So you can insert into a tab group without changing the current
tab, if you want.

(cherry-picked from commit 58b8633e3d)
2022-06-19 13:14:54 +01:00
Sergio Martins
e63a34a4a5 Rename DockRegistry_p.h -> DockRegistry.h
People use it.
2022-06-18 09:28:03 +01:00
Sergio Martins
8be6183543 Include cleanup
Removed unneeded controllers/ includes from headers
2022-06-18 09:15:30 +01:00
Sergio Martins
26ba2199cb Moved 2 more DockWidget enums to KDDockWidget.h
So users don't have to include controllers/DockWidget.h
2022-06-18 08:16:16 +01:00
Sergio Martins
a609f2233b Move DockWidgetOption enum to KDDockWidget.h
controllers/DockWidget.h is not something users will include directly
2022-06-18 00:27:58 +01:00
Sergio Martins
29c675661f cleanup regarding DockWidget::show() 2022-06-15 05:32:54 +01:00
Sergio Martins
755bc6ac14 cmake: Don't add src/ to include path
Fully qualify includes instead
2022-06-14 16:57:22 +01:00
Sergio Martins
1acbf48786 Don't depend directly on QSizePolicy, as that's QtWidgets
Introduce our own enum. Soon our qtquick frontend won't link
against QtWidgets
2022-06-11 18:22:38 +01:00
Sergio Martins
0031f1bcfd Release build now builds 2022-06-11 15:24:19 +01:00
Sergio Martins
5791198c51 qtquick: Fix some benign sizing warnings
During resize QtQuick will trigger lots of calls to setSize()
since it updates the width and the height separately.

Run our sanity checks only after with width and height are done
being updated, and not twice
2022-06-10 15:33:16 +01:00
Sergio Martins
a94daba3fc Bound the suggested floating window geometry
Because why not, seems correct. No bug would happen with QtWidgets
since QtWidgets respect the min sizes of their children, but for
QtQuick it's more flaky as there's no intrinsic mechanism for
min sizes, so give it some help
2022-06-10 14:16:57 +01:00
Sergio Martins
5faf36700b Use qGuiApp instead of qApp
As QtQuick applications might not have QApplication.
2022-06-06 13:24:38 +01:00
Sergio Martins
581451c342 Remove old ViewWrapper::asDropArea()
It's unneeded, and it wasn't implemented for QtQuick
2022-06-06 10:28:44 +01:00
Sergio Martins
792aaf76da Normalize handling of close event for Frame and FloatingWindow too
Fixes windows not closing correctly for QtQuick
2022-06-05 12:47:53 +01:00
Sergio Martins
f11a6a6a8c Honour View::closeRequested signal
This noramalizes how both qtwidgets and qtquick were handling it.
Fixes tests related to close events in qtquick
2022-06-05 03:23:19 +01:00
Sergio Martins
f1f722f1ce Replace TODOv2 tags with TODOm2 and TODOm3 tags
Not all todos are required for milestone m2
2022-06-04 19:53:25 +01:00
Sergio Martins
2e92357adc Add View::setZOrder()
Only relevant to QtQuick.
Removes some ifdefs.
2022-05-31 10:37:14 +01:00
Sergio Martins
22f6f4b2f1 Rename DockWidget::parentChanged() to parentViewChanged() for clarity
As this about the visual parent
2022-05-30 19:25:24 +01:00
Sergio Martins
b19f2dfbed Remove unneeded ifdefs 2022-05-30 19:23:12 +01:00
Sergio Martins
2421e607a9 Users now instantiate DockWidget view instead of controller
The controllers are private and not intentend for the public.
2022-05-30 11:45:43 +01:00
Sergio Martins
fb8639969c Delete QObject::setParent() in the controller
To find places where we're setting parent on the controller instead
of in the view. Fix such case where the dock widget view
wasn't being parented to the frame view.
2022-05-27 13:25:06 +01:00
Sergio Martins
fc74698dac Remove some unused qtwidget includes from controllers/ 2022-05-26 10:02:28 +01:00