Commit Graph

3638 Commits

Author SHA1 Message Date
Sergio Martins
f24a04252b Add a prophylactic against a crash
Crash seen in the wild. Can't reproduce, but could happen if the deletion
was triggered by some external event during a drag.

We're using a QPointer already, so it even makes sense.
2023-03-17 10:58:22 +00:00
Sergio Martins
dd9837c3f1 Fix assert when saving mdi layout
Since the layout is nested, we need to look further for the main window.

I don't know however if restoring layouts even works with MDI.
Needs to be tested and implemented.
2023-03-14 23:10:14 +00:00
Sergio Martins
b6beb3d244 Add test for #352
Commented out, since we can't use an XFAIL, as it crashes
2023-03-14 23:00:54 +00:00
Sergio Martins
1a46823b03 Don't crash when using LayoutSaver with MDI
It's not supported but it shouldn't crash.
For #352, leaving it open still, as the reporter actually experiences
an assert, not a segfault. To be investigated further
2023-03-14 22:54:46 +00:00
Sergio Martins
4d50376ccf Fix reading floating window flags from >=1.6 layouts
1.7 introduced per-floating-window "flags" in the saved layouts. When
that value is not present in the saved layout, we need to fallback from
reading from Config global settings
2023-03-10 17:16:10 +00:00
Sergio Martins
59f7280d59 Add test for loading flags from layouts from 1.6
1.7 now has flags per floating window. When loading a layout from
1.6 we need however to fallback to the global Config::flags()
2023-03-10 17:10:37 +00:00
Sergio Martins
683dd68754 Update Changelog
Lot's of stuff was missing
2023-03-08 22:33:21 +00:00
Sergio Martins
1b33da8b44 Windows: Don't resize diagonally when at least 1 dimension is fixed
If width is fixed and height is not, then when using the corner resize
only width can be changed (and same for fixed height).

Fixes #345
2023-03-06 19:56:21 +00:00
Sergio Martins
f6d9ac5606 debug: Allow to print flags
For issue #345
2023-03-03 16:17:29 +00:00
Sergio Martins
f08d39ecc8 Fix clazy warning about returning false in event filter
Use the base class instead
2023-02-28 12:34:10 +00:00
Sergio Martins
ee5e004ed2 Fix some icons not appearing in title bar
Looks like QIcon was being added into the cache after it was already
moved from.
2023-02-27 22:50:25 +00:00
Sergio Martins
c744291d33 README: Explain that QtQuick does not work on EGLFS
For issue #342
2023-02-15 13:05:31 +00:00
Allen Winter
a6e0de9db9 .pre-commit-config.yaml - disable pylint on precommit.ci 2023-02-10 10:38:42 -05:00
Milian Wolff
0ad83ea1b4 Allow restoring layouts without touching floating dock widgets
The current behavior is great for when we want to apply an older
stored state to a different screen configuration. There,
scaling/shrinking the floating docks makes sense.

But we now also want to have more fine grained window
configurations and save/restore them more frequently. In those
situations, the screen config is the same, but the mainwindow may
or may not be full screen when the state was saved. In this case
we don't want to touch the size of the floating docks - most notably
we don't want to resize a "nearly fullscreen" floating window from
a state with a small main window when loading it into a state with
a fullscreen mainwindow - in such situations the floating window would
get resized beyond the available screen space!

Preventing the latter is probably required as a safety measure
independently of this patch, for situations where the relative
resizing is desired. This is outside the scope of this patch.
2023-02-10 15:13:09 +00:00
Sergio Martins
fdcdaae1f1 Fix build with C++11
initialized lambda captures is a C++14 extension
2023-02-10 14:53:42 +00:00
Sergio Martins
af455bb37e examples: Show how to hide dock indicators when ctrl is pressed
Fixes issue #334 and issue #337.
Won't add this directly into the library, as each project
has different requirements regarding this.

It's easy to do in application code though.
2023-02-07 23:51:20 +00:00
Sergio Martins
57aded2a67 Fix setDropIndicatorsInhibited(false) not showing drop indicators
It required the user to move the mouse, which was OK but we can do
better.

Now, KDDW will automaticallt re-show the drop indicators if we're in
the middle of a drag operation.

Required for issue #334 and issue #337
2023-02-07 21:58:37 +00:00
Aleš Petrovački
31b0ad8d7d Update Readme with new image on top of it 2023-02-06 18:26:02 +01:00
Aleš Petrovački
3ae7f4ac21 Add logo to KDDockWidgets git repo 2023-02-06 18:22:41 +01:00
Sergio Martins
5b3fb35679 cmake: Add a preset for static Qt6 builds 2023-02-03 19:04:52 +00:00
Sergio Martins
c39486ce84 vscode: Remove ms C++ extension settings
I'm on clangd instead.
I could leave them there, but no idea if they are correct.
Once we have a developer using the MS extension then he's free
to maintain the options.
2023-02-01 17:16:34 +00:00
Sergio Martins
e7bc93a69f Fix relayouting when dock widget is deleted directly
Usually, it's closed. "delete" isn't very well tested.
When it's deleted the container item becomes empty, so needs
to be resized to QSize(0,0) as well.

There's already a codepath for that but was too restrictive.
It now handles that case too.

Fixes #336
2023-01-27 18:09:34 +00:00
Sergio Martins
f2c3fe6910 tests: Add an XFAIL for issue #336 2023-01-27 16:23:36 +00:00
Sergio Martins
2326874be7 Cache TitleBar icons
Minor performance improvement. Detected by Milian when profiling.
2023-01-27 14:36:05 +00:00
Mauro Persano
1fc57b02b3 Save side bar overlay geometry when frame is resized
Previously we were updating the side bar overlay geometry only when the
side bar was closed. So if we open the side bar overlay, resize it, and
save/restore the layout state, we won't get the last side bar size.

Save it every time the frame is resized.
2023-01-27 12:19:26 +00:00
Mauro Persano
c55ce478df Serialize dock overlayed geometries
Otherwise the size of auto-hidden dock widgets won't get restored.
2023-01-27 12:19:26 +00:00
Sergio Martins
b0dfbc4486 Fix Werror build regarding unused variable 2023-01-26 22:57:39 +00:00
Allen Winter
6f6679d6be update copyright year to 2023 2023-01-06 12:24:12 -05:00
Sergio Martins
a6598d4607 Fixed build with -Wextra-semi 2023-01-06 17:14:58 +00:00
Sergio Martins
32b0e024d8 Fixed case of corrupt layout when using setDockWidgetFactoryFunc()
If the factory returned null for some dock widget, then the layout
would have holes. They need to be turned into placeholders, which
will be invisible.

Move the test into the QtWidgets guard. There's no point in making
it agnostic, since the bug is in the layouting.
2023-01-06 15:24:02 +00:00
Sergio Martins
392504e902 test: Add test for a bogus layout
The layout is creating holes when we skip restoring 1 dock widget
2023-01-05 22:34:30 +00:00
Sergio Martins
5b484a7dda tests: Added a test for issue #326
Currently an XFAIL
2022-11-18 11:50:20 +00:00
Mauro Persano
4be77d96df Fix layout scaling factor when main window is native
When a main window is serialized, we get the geometry to be serialized
with MainWindowBase::windowGeometry. When the layout is restored, we
get the geometry of the current window with window()->geometry() and use
it to compute the scaling factor.

The values returned by MainWindowBase::windowGeometry and
window()->geometry() will differ if the main window is a native widget,
but not a toplevel window. In this case, windowGeometry returns the
geometry of the main window widget, not of its containing window.

Use MainWindowBase::windowGeometry when computing the scaling factor, so
that these geometries are consistent and the scaling factor is correct.
2022-11-14 11:03:46 +00:00
Sergio Martins
8947c56442 Improve auto-hide icon transparency
They had non-transparent corners
2022-11-10 11:35:30 +00:00
Sergio Martins
35bf7bc9c8 Fix moving floating windows to negative positions
QScreen::geometry() is already in "virtual coordinate space", no
need to map again. Bug wasn't noticeable since most setups
have virtual top left at 0,0, so it was a no-op in most cases.

Fixes bug #321
2022-10-28 12:08:38 +01:00
Allen Winter
0d943620ac README.md - add blurb about demo 2022-10-27 16:10:07 -04:00
Allen Winter
8f6c659021 CMakeLists.txt - change name of demo 2022-10-27 16:09:56 -04:00
Allen Winter
a82f2afa64 create-demo-win-zip - create a 7z with the example execs
Add a "createZipDemo" buildsystem target to run this.
The 7z includes the Qt runtime.
2022-10-27 11:45:55 -04:00
Allen Winter
f1ae102383 pre-commit - autoupdate, and markdownlint config 2022-10-25 07:53:28 -04:00
Eism
34a7bfd0e5 Fixed using normal geometry of platform window if fractional scaling is enabled 2022-10-06 10:47:15 +01:00
pre-commit-ci[bot]
1f27716020 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-clang-format: v14.0.0 → v14.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.0...v14.0.6)
- [github.com/PyCQA/pylint: v2.15.2 → v2.15.3](https://github.com/PyCQA/pylint/compare/v2.15.2...v2.15.3)
2022-09-28 20:12:44 +01:00
Sergio Martins
4706392464 Amend last commit by using the shorter name, UseQtWindow
Still, one redundant flag was removed, but now, the one with
the long name.

For #314
2022-09-25 19:16:57 +01:00
Sergio Martins
3a9b583552 Remove uneeded FloatingWindowFlag::UseQtWindow
There's already DontUseQtToolWindowsForFloatingWindows
2022-09-25 19:05:59 +01:00
Sergio Martins
9a74839910 FloatingWindow::isUtilityWindow() now honours custom flags
If the user has passed custom per-window flags then we shouldn't
use the global ones.

Fixes minimize problem in #314
2022-09-25 18:47:31 +01:00
Sergio Martins
322ac107e3 refactoring: Move KDDockWidgets::usesUtilityWindows into FloatingWindow.cpp
No behaviour change for now, just moving.
Its usage is tricky, so it should only be used in one place, so we
can honour FloatingWindow::m_flags overrides too.

For issue #314
2022-09-25 17:27:45 +01:00
Sergio Martins
e98633b664 Remove unused variable, which fixes Windows build 2022-09-17 11:35:31 +01:00
Sergio Martins
290c0815e8 Update Changelog regarding issue #314 2022-09-16 18:42:11 +01:00
Sergio Martins
40d57e5000 Honour FloatingWindowFlag::DontUseParentForFloatingWindows 2022-09-16 18:42:11 +01:00
Sergio Martins
f2218f8ff3 Add Frame::requestedFloatingWindowFlags()
Just so we can share this bit of code without duplicating it
2022-09-16 18:42:11 +01:00
Sergio Martins
c070a11312 Remove FloatingWindowFlag::DontUseQtToolWindowsForFloatingWindows
UseQtTool and UseQtWindow have the same effect
2022-09-16 18:42:11 +01:00