Commit Graph

36 Commits

Author SHA1 Message Date
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
Sergio Martins
927510dfff Support re-ordering tabs with mouse
Just set KDDockWidgets::Config::Flag_AllowReorderTabs before creating
the dock widgets.

Fixes #20
2019-12-26 15:19:27 +00:00
Allen Winter
41d07ef8c6 examples - include guards. use qrand() 2019-12-10 14:48:10 -05:00
Sergio Martins
8e437f598b Remove old readme from the example, it's no longer relevant 2019-10-22 16:44:18 +01:00
Sergio Martins
e4eac7a688 demo: Fix startup delay 2019-10-22 14:17:57 +01:00
Sergio Martins
44bcfdf53c Simplify the demo, make it more verbose
So people see how the API is used.
using vectors of structs with parameters is very compact but
is harder on the reader of a new API
2019-10-22 13:39:41 +01:00
Sergio Martins
a9f5917a54 demo: Make it look nice
Logo now scales better
2019-10-22 13:10:01 +01:00
Sergio Martins
fa8aaeff50 Use KDAB artwork for the dockwidgets example
Work in progress but already looks good.
2019-10-21 23:08:59 +01:00
Sergio Martins
787f7802be Move the private code into a private/ folder
It's nice to have a similar include hierarchy at build time and install
time.

It also makes things more explicit
2019-10-20 19:24:54 +01:00
Sergio Martins
511a035df1 Install more missing _p.h headers to private/
The custom separator example is disabled for now, as we're not
installing the multisplitters headers yet
2019-10-07 13:55:09 +01:00
Sergio Martins
a0787f1488 examples: Move custom_titlebar code into kddockwidgets_example
Guarded with a command line switch, no need to have two examples
2019-10-06 22:26:09 +01:00
Sergio Martins
0e5f5bf679 examples: tidy 2019-10-06 14:47:42 +01:00
Sergio Martins
1adefed05d examples: Remove the embedded option
It was just for testing the MFC case, which is fixed and integrated
into the unit-tests. Not something interesting for end-users
2019-10-06 14:39:05 +01:00
Sergio Martins
2ee1cac097 examples: Use QCommandLineParser 2019-10-06 14:34:31 +01:00
Sergio Martins
d1d9c027c7 example: Move the main window to its own class
Renamed ExampleDockableWidget to MyWidget
2019-10-06 14:12:38 +01:00
Sergio Martins
e0f76ba38b cmake: target renaming for the examples 2019-10-06 13:40:43 +01:00
Sergio Martins
9504a728d4 Rename basic_external to dockwidgets
This will be our main example now
2019-10-06 13:29:40 +01:00