Commit Graph

56 Commits

Author SHA1 Message Date
Sergio Martins
198bd60565 example: Added --blocks-close-event
Makes dock widget #0 reject the close event, meaning it won't close.

(cherry-picked from commit 21765efbac)
2022-06-19 11:18:02 +01:00
Sergio Martins
1ee5d21d4a examples: Remove controller usage, use views instead
Controllers is low level API
2022-06-18 08:36:09 +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
921d94d731 Added MainWindow_qtwidgets::setPersistentCentralWidget()
Which is nicer for the end user as it deals in QWidget
2022-06-15 19:37:12 +01:00
Sergio Martins
01b2bbc11c Rename "persistent widget" to "persistent view" 2022-06-15 19:27:04 +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
ec56120290 Don't include controller headers in view headers
view headers will be installed, so shouldn't leak impl details
much. Controllers are more low level things that the user won't use
much
2022-06-13 19:44:47 +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
f719697852 Remove DockWidget::setWidget(QWidget) 2022-05-14 09:38:55 +01:00
Sergio Martins
9f7c4cb217 Removed the DockWidgetBase typedef
That existed only to ease porting
2022-05-10 22:53:16 +01:00
Sergio Martins
15601fc3c9 Split MainWindow into view/controller 2022-03-30 11:51:31 +01:00
Sergio Martins
9fba1e9799 Rename Controller::DockWidgetBase to Controller::DockWidget
As done for other controllers
2022-03-25 10:53:02 +00:00
Sergio Martins
63b5109113 Rename Views::MainWindow to Views::MainWindow_qtwidgets
As done for other views
2022-03-25 10:41:46 +00:00
Sergio Martins
264b08a731 Move MainWindow view into Views namespace 2022-03-25 10:40:16 +00:00
Sergio Martins
c6d95c42a8 Split most widgets into a Controller and a View
Controllers don't have any GUI and don't depend on the frontend
technology.

Views are implemented in a specific GUI tech (QtWidgets, QtQuick, etc).

For now only QtWidgets work. There's still a lot to decouple.

This will make it easier to introduce non-Qt backends.
2022-03-24 16:05:37 +00:00
Allen Winter
93e60a743e update copyright year 2022-01-20 08:05:26 -05:00
Waqar Ahmed
f6f772edc5 Fix leaks in kddockwidgets_example 2021-09-17 11:27:09 +01:00
Sergio Martins
1ccdf445eb Introduce MainWindowOption_HasCentralWidget
You can now set an arbitrary widget as "central widget".
It's similar to MainWindowOption_HasCentralFrame, however the widget
won't be detachable and won't show tabs.

Similar to what you'd get with QMainWindow central widget concept.

Example:
    QWidget *myWidget = new MyWidget();
    mainWindow->setPersistentCentralWidget(myWidget);

Fixes #225
2021-08-30 10:12:46 +01:00
Sergio Martins
701df72db6 Remove some ifdefs regarding 5.9
The one missing QT_VERSION_CHECK was even wrong and triggering
even with Qt 5.15.
2021-07-01 16:54:44 +01:00
Sergio Martins
cd0f2f4e33 Introduced Config::setDropIndicatorsInhibited(bool)
Allows you to disable support for drop indicators while dragging
2021-05-18 18:00:04 +01:00
Sergio Martins
a4d03c1514 Add a mdi-example
Don't want the main example to be too complex
2021-02-13 12:01:01 +00:00
Sergio Martins
8dca2e346c Add experimental MDI support 2021-02-09 19:25:28 +00:00
Sergio Martins
2834532b5f example: Add a keyboard shortcut to toggle dock widgets visiblity 2021-01-21 16:22:43 +00:00
Sergio Martins
e0e6f55868 Introduce DockWidgetBase::LayoutSaverOptions enum
The first enumerator is "Skip", meaning the dock widget won't
be affected by save/restore. It won't disappear while restoring,
and won't be shown if already hidden. (only applies to floating widgets)
2021-01-11 23:33:32 +00:00
Allen Winter
a2f4c972a6 update copyright year 2021-01-02 09:27:50 -05:00
Sergio Martins
cd859d6725 Fix a bunch of clazy warnings 2020-12-22 17:01:50 +00:00
Sergio Martins
f8d0ffe7ba Fix a few clazy warnings 2020-12-22 16:02:55 +00:00
Sergio Martins
fad81d595a qtquick: Remove some dependencies to QApplication 2020-11-26 19:31:32 +00:00
Sergio Martins
0a6f760100 Fix a couple of clazy warnings 2020-08-07 22:23:08 +01:00
Allen Winter
b4f49895c2 clarify: licensing is GPL2 or GPL3 or commercial licensed
follow the REUSE specs
2020-07-24 18:16:13 -04:00
Sergio Martins
2a33599bde Fix range-loop detachements 2020-06-23 17:48:40 +01:00
Sergio Martins
9601f57050 example: Don't show the dock widgets immediately
It's not needed, as they are going to be added to the layout.
Saves us from flicker and also the temporary floating position
being saved
2020-06-05 13:43:35 +01:00
Sergio Martins
798c808790 example: Set the max-size on the guest widget not on the dock
the size constraint will propagate up
2020-05-28 17:48:10 +01:00
Sergio Martins
d94263fce5 Allow each dock widget and main window to support multiple affinities 2020-05-25 14:14:17 +01:00
Sergio Martins
235018bfae example: Set the max-size before docking 2020-05-20 10:05:11 +01:00
Sergio Martins
dc87c05f04 example: Add an option to text max-sizes
Support not done yet, but useful for testing
2020-05-19 23:22:39 +01:00
Laurent Montel
d2531d48d3 Make it compile against qt < 5.10 QRandomGenerator was created in qt5.10 2020-05-19 11:20:28 +02:00
Laurent Montel
8b81cd12f8 Compile without deprecated method (qrand is deprecated. Replaced by QRandomGenerator) 2020-05-19 11:03:38 +02:00
Sergio Martins
af25af1259 Add MainWindow::layoutEqually()
Distributes the space equally between all dock widgets
2020-05-18 00:05:50 +01:00
Sergio Martins
a9e02ccd41 example: Don't leak the dock widgets on shutdown 2020-05-17 18:02:03 +01:00
Sergio Martins
97c1ca30fd Layouting engine rewrite
The layouting was becoming too complex to maintain and to introduce
new features. Was even buggy, the fuzzer was constantly finding
bugs, which took hours to workaround.

Problem with the old layout engine is that there was a catch 22, between
Items driving the separators, and separators driving the anchors.

The new layout is much simpler, both in implementation and conceptually.
There's simply a recursive hierarchy of Item elements. An Item can either
have a QWidget to show, or be a ItemContainer, which contains Item children,
and so forth. Each ItemContainer is either vertical or horizontal. That's enough
to represent the "nested multi-splitter" concept which KDDW uses.

After each item insertion/deletion/resize, the separators are regenerated. They
are essentially dumb now.

TODO:
- Separators are drawn, but are not interactive yet
- There's 5 tests failing
- LayoutSaver scalling functionality
2020-05-04 00:02:03 +01:00
Sergio Martins
ab0fc1e328 Add DockWidget::Option_NonDockable
A dock widget with this option will always be floating and not be
able to dock into anything. Other widgets can't dock into it either.
2020-04-13 13:23:38 +01:00
Sergio Martins
b2c3442233 example: Move the floating window away from the top-border
Fixes on Windows the its titlebar being hidden
2020-03-24 11:16:27 +00:00
Sergio Martins
170f4efbb2 example: Add a menu action to close all dock widgets 2020-02-25 23:23:36 +00:00
Sergio Martins
043b481ddd Example: Add a quit action 2020-02-25 23:19:10 +00:00
Sergio Martins
ca211f2494 LayoutSaver: Add an option to restore in relative sizes
and not touching the main window geometry.

The option is not exposed yet, there's a layouting bug to fix first.
2020-02-25 19:06:43 +00:00
Sergio Martins
6fb0694aab LayoutSaver: Replace saveToDisk() with saveToFile(jsonFilename)
Same for restore.
This is better API as LayoutSaver shouldn't be concerned about
QSettings. It also assumed the user only had a single layout, which
is normally not the case.

And finally, storing escaped json in .ini files is not very elegant.
2020-02-24 15:10:12 +00:00
Sergio Martins
b43081851f example: Add an option to show a non-closable dock widget
Passing -n to the example will make the dock widget #0 non-closable
2020-02-17 21:20:43 +00:00
Sergio Martins
d6997eaf7f Introduce main window affinity
By default a dock widget can dock into any main window.
With affinities, we can now have a dock widget "belong" to a main window
and only be able to dock into it (or into other floating dock widgets
with the same affinity).

See DockWidgetBase::setAffinity() and MainWindowBase::setAffinity().
2020-02-09 21:02:21 +00:00