Commit Graph

3549 Commits

Author SHA1 Message Date
Sergio Martins
037140b980 Add KDDockWidgets::initPlatform()
Instead of using the static variable, which is initialized before
having QApplication.

Will allow us to remove the QTimer from Platform init
2022-04-11 00:55:28 +01:00
Sergio Martins
8cd05c7314 Add Platform::createDefaultFrameworkWidgetFactory() 2022-04-10 23:54:52 +01:00
Sergio Martins
ec0e841bb8 Introduce qtwidgets/FrameworkWidgetFactory_qtwidgets
It doesn't scale to support all platforms with ifdefs, instead, use one
file per platform
2022-04-10 21:15:10 +01:00
Sergio Martins
613a18f60c Delete operator== for ViewWrapper
Fixes a bug in the tests too
2022-04-10 20:47:33 +01:00
Sergio Martins
d6fd54cec4 Por all usages of QWindop/windowHandle to KDDockWidgets::Window
Removes a lot of asQWidget() code and is also prepared for non-Qt
views.
2022-04-09 19:21:56 +01:00
Sergio Martins
5a8f176860 Add Window
A non-Qt abstraction around QWindow
2022-04-08 11:45:15 +01:00
Sergio Martins
8cfb10ef10 Use View::setParent() instead of QWidget::setParent() 2022-04-07 22:54:50 +01:00
Sergio Martins
95671f9d9a Add Platform_qt, a baseclass for both Qt frontends
So we can share some code between QtQuick and QtWidgets
2022-04-07 23:48:40 +01:00
Sergio Martins
427af43904 Remove some QtWidgetisms from DockRegistry 2022-04-07 23:16:43 +01:00
Sergio Martins
4944ad5882 Add Platform::qobjectAsView()
to be removed once we port away from Qt, but needed for now to
support QtQuick
2022-04-07 23:10:01 +01:00
Sergio Martins
59f9824cc2 Fix typo during porting of test 2022-04-07 22:48:09 +01:00
Sergio Martins
71f0b644f2 Port away from including TitleBar_qtwidgets in tests 2022-04-07 22:43:56 +01:00
Sergio Martins
b60b54327b Port away from Item::guestAsQObject()
Use Item::guestView() instead.
2022-04-07 22:27:22 +01:00
Sergio Martins
0f2da43737 Rename guestWidget to guestView
As we deal in View now
2022-04-07 20:12:47 +01:00
Sergio Martins
558bd42447 tests: Remove more QWidget dependencies 2022-04-07 00:49:36 +01:00
Sergio Martins
7107bfe3e6 Remove _qtwidget include from utils.h 2022-04-07 00:40:25 +01:00
Sergio Martins
be150c1c52 Port DockRegistry away from QGuiApplication::focusObjectChanged
Use the Qt agnostic way, from Platform.h
2022-04-07 00:24:06 +01:00
Sergio Martins
9f4cb1a13e Port FocusScope away from QGuiApplication 2022-04-05 23:01:29 +01:00
Sergio Martins
0addad590e ViewGuard: Add a -> const operator too
So we can call it if const
2022-04-05 23:00:20 +01:00
Sergio Martins
793e48150a Don't access qApp directly from Platform's ctor
QApplication might not be created yet, so delay it
With a timer for now. Don't guarantee this will stay.
Explicit init by the user might be an alternative.
2022-04-05 22:29:01 +01:00
Sergio Martins
3ba4bc2d08 Add Platform::focusedView() and respective signal
Implemented as QGuiApplication::focusObjectChanged() for Qt,
other frontends will have their own impl.
2022-04-05 21:53:52 +01:00
Sergio Martins
43faf85eb4 Add View::isNull()
ViewWrappers don't have ownership of the gui element.
The gui element might have been deleted, leaving us with a
stale wrapper

For impl simply use a QPointer in the QtWidgets and QtQuick
backends
2022-04-05 21:50:21 +01:00
Sergio Martins
ad3febd87e Add copyright headers to tst_viewguard 2022-04-05 21:29:35 +01:00
Sergio Martins
3e4d172765 ViewGuard: Add a copy-ctor 2022-04-05 21:29:35 +01:00
Waqar Ahmed
607ec01feb Extend tst_viewguard to test signal trigger after destruction 2022-04-06 01:13:50 +05:00
Sergio Martins
dc14a309a7 ViewGuard: Fix potential crash if the ViewGuard is deleted.
There was nothing disconnecting from the lambda.
Probably KDBindings needs a ConnectionHolder RAII class
2022-04-05 20:28:05 +01:00
Sergio Martins
fdc56b938e ViewGuard: Fix ctor and assign operator having different behaviours
The difference was very small: The ctor honoured View::inDtor()
while the assign op didn't. It's easy to make them behave the same
by creating a setView() method

As a side-effect the duplicate connect() is also gone now
2022-04-05 20:25:14 +01:00
Sergio Martins
4b62714ef5 ViewGuard: Fix clear() not disconnecting
When clear is called we should disconnect the signal, as it won't
be needed anymore. Benign though.
2022-04-05 20:18:09 +01:00
Sergio Martins
2763aec6c2 ViewGuard: Fix English typo in comment 2022-04-05 20:15:05 +01:00
Sergio Martins
73b874ec0b Remove stray qDebug from Platform.cpp 2022-04-05 20:10:24 +01:00
Sergio Martins
124b521308 ViewGuard: Add copyright headers
Some formatting too.
2022-04-05 20:09:24 +01:00
Waqar Ahmed
b573d3f0f7 Introduce ViewGuard: A weak ptr to View 2022-04-05 17:05:17 +05:00
Waqar Ahmed
84497f422d Fix fallthrough warning 2022-04-05 10:11:46 +01:00
Sergio Martins
ccd7557c75 Add View::beingDestroyed signal
It's emitted in ~View
2022-04-05 10:11:37 +01:00
Sergio Martins
1116eff816 Don't create ViewWrappers with nullptr
Instead return a null shared ptr
2022-04-04 22:36:16 +01:00
Sergio Martins
55ab08129a Deal the wrappers in shared_ptr instead of unique_ptr
Easier to pass around and better for our use case, where we
actual can have shared usage
2022-04-04 22:14:19 +01:00
Sergio Martins
c94705593f Update qtquick stubs
Not compilable yet, but not in cmake either
2022-04-04 21:54:27 +01:00
Sergio Martins
4f0f82f6b4 Add ViewWrapper_qtquick stub 2022-04-04 21:52:41 +01:00
Sergio Martins
b76e45064f Add View_qtquick stub 2022-04-04 19:06:17 +01:00
Sergio Martins
97653f03be qtquick: Move old (unported) files to old/ folder
We'll start moving them to views/ and cleaning/porting them
2022-04-04 18:35:12 +01:00
Waqar Ahmed
96f3100f77 Cleanup nlohmann_qt_helpers 2022-04-04 22:27:29 +05:00
Waqar Ahmed
06501c8a70 Header include guards for nlohmann_qt_helpers 2022-04-04 22:20:59 +05:00
Waqar Ahmed
dc93db9276 Add nlohmann QDebug helper 2022-04-04 22:20:59 +05:00
Waqar Ahmed
d6e678883c remove toVariantMap/fromVariantMap functions 2022-04-04 21:51:16 +05:00
Waqar Ahmed
3c424474ee Restore layout using nlohmann directly 2022-04-04 21:51:16 +05:00
Sergio Martins
631736b202 Abstract away a call to qApp->activePopupWidget()
It's now generic and doesn't depend on QApplication.
Removes an ifdef.
2022-04-04 16:43:01 +01:00
Sergio Martins
495ef0dd6a Move QmlTypes references out of DockRegistry
As it's specific to QtQuick
2022-04-04 16:36:17 +01:00
Sergio Martins
2a379d8735 Add Platform_qtquick
CMake hacked for now. Not sure if we should allow building
both QtWidgets and QtQuick frontends at the same time
2022-04-04 16:30:57 +01:00
Sergio Martins
6fcc55ce60 Add missing include 2022-04-04 16:30:41 +01:00
Sergio Martins
a36f85aae3 Add Platform and Platform_qtwidgets
So we can start removing QtWidgets vs QtQuick ifdefs.
Each "platform" will implement the differences
2022-04-04 16:21:35 +01:00