Commit Graph

66 Commits

Author SHA1 Message Date
Sergio Martins
5a66d09266 example: Decouple Flag_HideTitleBarWhenTabsVisible from Flag_AlwaysShowTabs
New swtich -z will trigger Flag_AlwaysShowTabs.
use -zt for what was -t before.

This is more granular now, as they are mix and match
2020-08-27 14:52:48 +01:00
Sergio Martins
e3f89b6c17 Remove unneeded include 2020-08-25 21:57:55 +01:00
Sergio Martins
f1b9ce714b Fix building user apps out of repo
Our example was being built as part of KDDW, so that worked fine.
Now it can also be built with an installed KDDW.

Problem was the folder hiearchy in the installed include dir
didn't match the folder hiearchy in the source repo

Fixes #62

Cherry-picked from master's 037fa76fff
1.0 makes more sense
2020-08-14 18:47:03 +01:00
Sergio Martins
0a6f760100 Fix a couple of clazy warnings 2020-08-07 22:23:08 +01:00
Sergio Martins
96a3eea108 Silence some clazy warnings which are benign in this context 2020-08-07 21:56:17 +01:00
Sergio Martins
22a13c7c9c Fix widgets example
Committed some things I shouldn't have during the qml port
2020-08-04 18:23:22 +01:00
Sergio Martins
52626b1874 qml: Add support for the MainWindow
Not really a MainWindow in the sense of toolbars and all.
For qml it's just the drop area, acepting drops
2020-08-03 20:05:36 +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
Allen Winter
2462f991be buildsystem - consistent formatting 2020-06-25 13:32:59 -04:00
Allen Winter
c5739e8626 examples/dockwidgets/CMakeLists.txt - increase cmake min vers
to make consistent with the top-level project
2020-06-25 10:42:57 -04:00
Sergio Martins
2a33599bde Fix range-loop detachements 2020-06-23 17:48:40 +01:00
Sergio Martins
3b5ca4dafb Silence -Wclazy-non-pod-global-static for the example
we don't care about non-lib example code regarding this
2020-06-23 17:12:21 +01:00
Sergio Martins
b8664c44c7 example: show the use of max-sizes without developer-build
the feature is stable to show
2020-06-17 16:29:45 +01:00
Sergio Martins
e6b67101fa Make the example customize TitleBarWidget instead of TitleBar
TitleBar will cease to depend on QWidget
2020-06-11 21:26:33 +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
f770e768b8 example: Add option to load a layout from file 2020-05-26 21:53:58 +01:00
Sergio Martins
63c90875aa example: Add example of docking main window into main window 2020-05-25 21:45:21 +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
2fd9d45525 Link multisplitter as a PUBLIC dependency if kddockwidgets
This way user doesn't need to explicitly link against it
2020-05-25 06:52:25 +01:00
Sergio Martins
8461f1f79e kddockwidgets_multisplitter is now a library of its own 2020-05-25 06:45:13 +01:00
Sergio Martins
ba49e1cbe2 Separator no longer inherits from QWidget
Only SeparatorWidget does
2020-05-24 20:29:49 +01:00
Sergio Martins
3bbc33d8c4 example: Revive the custom separator example
Pass -p to see a custom painted separator
2020-05-24 19:31:15 +01:00
Sergio Martins
215e8cfd24 example: Cleanup some options a bit 2020-05-20 14:25:23 +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
3742e5ef9a example: No persistent central frame by default
This is old style, which we don't use anymore by default
2020-05-07 19:32:32 +01:00
Sergio Martins
e298667351 Remove dead code about static separators
Before we had separators on the left,top,bottom,right margins
with 0 width. Now we don't have this concept anymore
2020-05-04 14:28:59 +01:00
Sergio Martins
0595448bba Replace Anchor with Separator
We don't have the concept of Anchors anymore. Code is now simpler
2020-05-04 13:10:38 +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
144897e831 Fix namespaced build 2020-05-01 15:35:05 +01:00
Sergio Martins
e87f6d001e example: Fix duplicate command line argument switch 2020-05-01 13:09:27 +01:00
Sergio Martins
8cc53ca5bb Also build the example when building KDDW
No need to install the library anymore
Fixes: #42
2020-05-01 13:07:25 +01:00
Sergio Martins
6ee3cfbb2d Introduce "Maximize/restore" title bar button support
As happens with other docking frameworks:
- Maximized/restore button only visible when window is floating
- floating button is never visible

Available by setting Flag_TitleBarHasMaximizeButton.
Added example too.

Fixes: #37
2020-04-20 19:55:51 +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
90b893e46a Introduce Flag_DoubleClickMaximizes
Double clicking on the title bar of a floating window will maximize it.
2020-02-27 15:00:31 +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
10621f3b4a Allow tabs to have a close button
Can be tested with kddockwidgets_example -c

Disabled by default, as I'm not 100% happy with it:
A dock widget with the "non closable" attribute will still show
the x button on the tab bar. Clicking on it won't do anything but
doesn't look so nice. Qt doesn't allow to have the close buttons only
in some tabs.

Fixes #26
2020-02-17 20:45:54 +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
Allen Winter
df692686e7 various - update copyright year 2020-01-07 11:36:56 -05:00
Sergio Martins
9c6fd9ba0e Add support for lazy resize
In this mode the resize is only done when mouse is released.

Fixes #21
2019-12-29 17:55:19 +00:00