Compare commits

...

48 Commits

Author SHA1 Message Date
Allen Winter
9990300006 distro/qt5-kddockwidgets.spec - add BuildRequires for SUSE
libqt5-qtbase-private-headers-devel is needed
2021-11-24 12:32:06 -05:00
Allen Winter
573e82e9eb update 1.5.0 release date 2021-11-24 12:20:15 -05:00
Allen Winter
07a135a10a ECMGeneratePriFile.cmake - restore "Fix issues with pri file"
commit b81c32b1c9
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date:   Mon Dec 28 20:46:28 2020 -0500
2021-11-24 12:14:16 -05:00
Sergio Martins
fc172b66f8 Explain that changing window manager flags isn't portable
This restriction comes from Qt itself, not from KDDW.
Relates to bug #256

I will however try to reproduce it
2021-11-24 11:16:36 +00:00
Sergio Martins
2be0d5d1d9 Add a warning about using private headers and ABI compat 2021-11-24 10:04:52 +00:00
Allen Winter
3007b46892 ready for 1.5 release 2021-11-22 08:16:54 -05:00
Allen Winter
1419db80a2 OBS distro fixes 2021-11-19 18:03:22 -05:00
Allen Winter
5376ceec7e prep for the 1.5.0 release 2021-11-19 15:39:19 -05:00
Allen Winter
d3a3e7502e appveyor.yml - temporarily disable testing on Windows
until I have the time to figure out a proper solution
2021-11-19 12:22:20 -05:00
Allen Winter
50c3f9b899 appveyor.yml - add bin to PATH on Windows
to fix 'ctest' on Windows
2021-11-19 11:00:44 -05:00
Allen Winter
8845fae147 appveyor.yml - fix typo 2021-11-19 10:23:55 -05:00
Allen Winter
0c291116b9 appveyor.yml - install mesa on ubuntu 2021-11-19 10:05:07 -05:00
Allen Winter
f0fa0281bf CMakeLists.txt - fix default install location on Windows 2021-11-19 09:59:56 -05:00
Allen Winter
313a17a96c appveyor.yml - add Qt to PATH 2021-11-19 08:58:07 -05:00
Allen Winter
9e2b1d3e44 move github CI to appveyor for all platforms 2021-11-19 08:33:43 -05:00
Allen Winter
a82a283b4b CMakeLists.txt - increase min Qt to version 5.15 2021-11-18 09:06:50 -05:00
Sergio Martins
b6770217bb README: Mention 5.15 is required
5.12 no longer compiles
2021-11-18 14:01:59 +00:00
Sergio Martins
c8b22e7ea5 Fix "Unpin" button not showing up in overlayed widgets 2021-11-18 12:15:23 +00:00
Sergio Martins
8dcaaaf853 tests|Qt6: Ignore benign warning coming from QQC material style
Needs to be fixed in Qt
2021-11-17 17:00:16 +00:00
Sergio Martins
32ecdb5b37 README-QtQuick: Bump the patch revisions of min supported Qt
Probably works with earlier, but not tested
2021-11-17 15:59:46 +00:00
Sergio Martins
099c7eafc8 tests: Fix QtQuick tests
normal geometry isn't supported for QWindow, only QWidget.
2021-11-17 15:41:50 +00:00
Sergio Martins
f872d6fbc1 tests: Fix issue found by ASAN
We need to ungrab the window before deleting it.
2021-11-17 15:12:06 +00:00
Sergio Martins
3e21787efb qtquick: Fully qualify setPersistentCentralWidget() arguments
So it works from QtQuick too
2021-11-17 14:13:01 +00:00
Allen Winter
58fcd8d04d conan/conanfile.py - change to version 1.5.0 2021-11-15 09:57:14 -05:00
Allen Winter
95d5146fce CMakeLists.txt - increase version for release candidate 2021-11-15 09:51:21 -05:00
Sergio Martins
ea6adafc13 Fix QtQuick build
Fixes #254
2021-11-09 09:45:15 +00:00
Allen Winter
f65cb2c0ce README.md - minor 2021-11-04 17:20:51 -04:00
Sergio Martins
fbde2bd202 cmake: Allow to not create "docs" target
Fixes integrating KDDW as sub-repo of other projects that
already define "docs" target. It would conflict.

namespacing the target name would be another optionm but in doubt
keep things simple
2021-11-03 09:14:25 +00:00
Sergio Martins
0cee15c0d3 Don't do relative positioning restore if main window changed screen
We only shift floating windows position for simple cases.
Fixes floating windows being restored out of bounds in some cases.
2021-11-02 19:11:29 +00:00
Sergio Martins
4b56a336a0 Fix build on macOS 2021-10-19 14:34:27 +01:00
Sergio Martins
56bec0db04 Replace KDDOCKWIDGETS_RUBBERBAND_IS_TOPLEVEL with config option
This way one doesn't need to rebuild KDDW to make the rubber band
top-level.

Added it as internal option, as this will seldom be used.
2021-10-17 11:17:41 +01:00
Allen Winter
dd979d191f CMakeLists.txt, python/CMakeLists.txt - some restructuring 2021-10-13 17:33:32 -04:00
Sergio Martins
a5f37f851b Fix relative inner resizing not working properly
When we resize the main window then we also resize the inner
dock widgets in the same proportion (based on saved percentages),
during a resize we should not recompute those percentages due to
rounding errors.

They were being recomputed by mistake, since only the root Item
was blocking them, but the function recurses into inner items

Fixes #186
2021-10-13 18:33:45 +01:00
Sergio Martins
052d8680dc Add a test for #186
Was hard to reproduce, doesn't happen with many other layouts
2021-10-13 15:37:02 +01:00
Sergio Martins
21e8aae823 Add a test for #238
Which I can't reproduce yet, but at least tests another case.
2021-10-12 18:36:50 +01:00
Sergio Martins
0e866079da qtquick: Fix parentChanged() passing the wrong argument
QQuickItem::parentChanged(QQuickItem *parent) passes the *new*
parent, not *this*

Fixes #243 which is actually invalid, but uncovered this bug.
For #243 you can just use sender(), or connect to a lambda that
captures the dock widget.
2021-10-12 11:46:16 +01:00
Sergio Martins
a8bd6ba840 Fix corrupt layout when restoring old JSON
If the old *.json file doesn't know about some new docked widget
then we need to float it before restoring the main window

Fixes #237
2021-10-12 11:16:15 +01:00
Sergio Martins
96aefdd3c7 Make tst_restoreNonExistingDockWidget more minimal
dock1 isn't required

And it's ok that dock2 remains open, the bug is actually that it
doesn't get resized when we resize the main window
2021-10-11 00:50:53 +01:00
Sergio Martins
753fe57b30 Add a failing test for bug #237 2021-10-11 00:25:10 +01:00
Sergio Martins
9587c1b1e3 Add a test for issue #245
I can't repro still. Will wait for more feedback from reporter.
2021-10-10 19:32:27 +01:00
Sergio Martins
bc1b296440 README: Explain that StyleSheets are not supported
It's intentional.

Closes #246
2021-10-10 19:20:00 +01:00
Allen Winter
5626b0120d PySide[2,6]ModuleBuild.cmake - restore noisy compiler warnings removal
somehow got lost
2021-10-05 17:08:32 -04:00
Allen Winter
e5d2f5f857 PySide[2,6]ModuleBuild.cmake - restore noisy compiler warnings removal
somehow got lost
2021-10-03 16:54:26 -04:00
Allen Winter
3eb52c46b1 python/examples/main.py - add instructions to generate rc_assets.py 2021-09-30 15:57:22 -04:00
Allen Winter
aaa64bf769 Merge pull request #248 from KDAB/pyside6-unittest
Fixed unit test for PySide6
2021-09-30 15:49:17 -04:00
Renato Araujo
b7b1d6d4e9 Fixed unit test for PySide6 2021-09-30 06:04:52 -07:00
Allen Winter
a90417de55 python/examples-qt6/main.py - uncomment rc_assets
commented by mistake
2021-09-29 17:17:54 -04:00
Allen Winter
73f08df224 Merge pull request #247 from KDAB/python38
Fixed module import for python 3.8
2021-09-29 16:41:26 -04:00
36 changed files with 401 additions and 228 deletions

View File

@@ -1,66 +0,0 @@
env:
global:
- secure: "NlWO/NTPlOU6cowOMuPOvjAprXVwIjmpHHf9CoMR71E2c/eBFFKIHj10kXuyFwz2KihHAIExmo9OlGtGniNWobvIrVrabO3dsOSb6UGbPAQkzQiyQLKsDNQAZx3nMuWEKBtMsVRee6rd7/2uGTY4WB5Ot3VhrUYcN1FoRgQQ9gk="
branches:
only:
- master
matrix:
include:
- os: linux
dist: bionic
- os: osx
osx_image: xcode11.5
env:
- QT_SELECT=qt5
- CMAKE_PREFIX_PATH=/usr/local/opt/qt
language: cpp
compiler:
- gcc
- clang
script:
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DKDDockWidgets_TESTS=True -KDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- make
- make test
notifications:
email:
recipients:
- allen.winter@kdab.com
- sergio.martins@kdab.com
on_success: never
on_failure: always
dist: bionic
addons:
apt:
update: true
packages:
- qt5-default
- qtbase5-dev
- qtbase5-dev-tools
- qtbase5-private-dev
- qttools5-dev
- qttools5-dev-tools
- qtdeclarative5-dev
- qtdeclarative5-dev-tools
- libqt5xmlpatterns5-dev
- libqt5xmlpatterns5
- qtxmlpatterns5-dev-tools
- libqt5x11extras5-dev
homebrew:
update: true
packages:
- qt5
coverity_scan:
project:
name: KDAB/KDDockWidgets
notification_email: allen.winter@kdab.com
build_command_prepend: cd build && cmake ..
build_command: make
branch_pattern: coverity_scan

View File

@@ -21,7 +21,7 @@
#
# -DKDDockWidgets_TESTS=[true|false]
# Build the test harness.
# Currently ignored unless you also set KDDockWidgets_DEVELOPER_MODE=True
# Currently ignored (except for Python bindings) unless KDDockWidgets_DEVELOPER_MODE=True.
# Default=false
#
# -DKDDockWidgets_EXAMPLES=[true|false]
@@ -89,8 +89,8 @@ else()
endif()
set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 4)
set(${PROJECT_NAME}_VERSION_PATCH 95)
set(${PROJECT_NAME}_VERSION_MINOR 5)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
set(PROJECT_VERSION ${${PROJECT_NAME}_VERSION}) #PROJECT_VERSION is needed by some ECM modules
set(${PROJECT_NAME}_SOVERSION "1.5")
@@ -132,7 +132,7 @@ if(${PROJECT_NAME}_QT6)
set(${PROJECT_NAME}_LIBRARY_QTID "-qt6")
else()
set(Qt_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.12")
set(QT_MIN_VERSION "5.15")
find_package(Qt5Widgets ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5Test ${QT_MIN_VERSION} REQUIRED)
set(${PROJECT_NAME}_LIBRARY_QTID "")
@@ -230,7 +230,7 @@ if(KDAB_INSTALL)
if(UNIX)
set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location")
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-$$VERSION" CACHE INTERNAL "Install to default KDAB Location")
set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "Install to default KDAB Location")
endif()
endif()
@@ -263,80 +263,86 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
)
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
endif()
else()
#Always disable tests, examples, docs when used as a submodule
set(${PROJECT_NAME}_IS_ROOT_PROJECT FALSE)
set(${PROJECT_NAME}_TESTS FALSE)
set(${PROJECT_NAME}_EXAMPLES FALSE)
set(${PROJECT_NAME}_DOCS FALSE)
endif()
if(${PROJECT_NAME}_TESTS)
enable_testing()
endif()
add_subdirectory(src)
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
if(${PROJECT_NAME}_EXAMPLES)
if(${PROJECT_NAME}_QTQUICK)
add_subdirectory(examples/qtquick)
else()
add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal)
add_subdirectory(examples/minimal-mdi)
set_compiler_flags(kddockwidgets_example)
set_compiler_flags(kddockwidgets_minimal_example)
endif()
endif()
if(${PROJECT_NAME}_DEVELOPER_MODE)
if(${PROJECT_NAME}_TESTS)
enable_testing()
add_subdirectory(tests)
# Require Qt5.15.1 or higher to run the tests_launcher tests on Mac
if(NOT APPLE OR Qt5Widgets_VERSION VERSION_GREATER 5.15.0)
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we can use threads.
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
endif()
if(NOT ${PROJECT_NAME}_QTQUICK)
# tst_multisplitter depends on QWidget
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
endif()
endif()
endif()
if(${PROJECT_NAME}_DOCS)
add_subdirectory(docs) # needs to go last, in case there are build source files
else()
add_custom_target(docs
COMMAND ${CMAKE_COMMAND} -E echo "Sorry, there is no docs target since KDDockWidgets_DOCS=OFF."
"Re-run cmake with the -DKDDockWidgets_DOCS=True option if you want to generate the documentation.")
endif()
# Add uninstall target
include(ECMUninstallTarget)
endif()
if(${PROJECT_NAME}_PYTHON_BINDINGS)
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC)
message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
endif()
endif()
if(${PROJECT_NAME}_PYTHON_BINDINGS)
add_subdirectory(python)
endif()
if(${PROJECT_NAME}_EXAMPLES)
if(${PROJECT_NAME}_QTQUICK)
add_subdirectory(examples/qtquick)
else()
add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal)
add_subdirectory(examples/minimal-mdi)
set_compiler_flags(kddockwidgets_example)
set_compiler_flags(kddockwidgets_minimal_example)
endif()
endif()
if(${PROJECT_NAME}_TESTS)
if(${PROJECT_NAME}_DEVELOPER_MODE)
add_subdirectory(tests)
# Require Qt5.15.1 or higher to run the tests_launcher tests on Mac
if(NOT APPLE OR Qt5Widgets_VERSION VERSION_GREATER 5.15.0)
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we can use threads.
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
endif()
if(NOT ${PROJECT_NAME}_QTQUICK)
# tst_multisplitter depends on QWidget
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
endif()
endif()
endif()
if(${PROJECT_NAME}_DOCS)
add_subdirectory(docs) # needs to go last, in case there are build source files
endif()
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
# Add uninstall target (not for submodules since parent projects typically have uninstall too)
include(ECMUninstallTarget)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@@ -1,11 +1,11 @@
* v1.5.0 (unreleased)
* v1.5.0 (24 November 2021)
- Install the Python bindings to "site-packages"
- The Python bindings for Qt6 use the "PyKDDockWidgetsQt6" namespace
- Co-installable with Qt6
- Adds support for non-detachable central widget, MainWindowOption_HasCentralWidget. (#225)
* v1.4.1 (unreleased)
-
- Fix corrupt layout when restoring old JSON
- Fix "Unpin" button not showing up in overlayed widgets
- Minimum Qt version is now 5.15
* v1.4.0 (16 July 2021)
- No longer supports Qt versions less than 5.12

View File

@@ -2,7 +2,7 @@ Supported Qt versions and toolchains
=====================================
KDDockWidgets for QtQuick requires a C++17 capable compiler and either
Qt >= 5.15.0 or Qt >= 6.2.
Qt >= 5.15.2 or Qt >= 6.2.1
TROUBLESHOOTING

View File

@@ -146,12 +146,23 @@ your application whenever updating KDDW.
Supported Qt versions and toolchains
=====================================
KDDockWidgets requires Qt5 >= 5.12 or Qt6 >= 6.1.
The QtQuick support requires Qt5 >= 5.15 or Qt6 >= 6.1.
KDDockWidgets requires Qt 5.15.x or Qt6 >= 6.2.
Regarding compilers, whatever toolchain is able to build Qt 5.9 should also be
fine. Note however that MSVC 2013 isn't supported anymore due to compiler crashes.
Styling
========
Almost all private widgets used by KDDW can be derived by the user to give them
a custom look. That's done by providing your own FrameworkWidgetFactory. Run
"kddockwidgets_example -p" to see that in action.
Qt StyleSheets are not, and will not, be supported. See the comments in
`examples/dockwidgets/MyTitleBar_CSS.h` for why. You can however use some minimal
CSS, as shown in that example, just don't report bugs about it.
Warning: When using private headers, be sure to rebuild your application whenever you
update to a new KDDW version. Binary compatibility is only kept when using public
headers.
Licensing

View File

@@ -19,6 +19,8 @@ skip_tags: false
# Build worker image
image:
- Ubuntu
- macos
- Visual Studio 2019
# scripts that are called at very beginning, before repo cloning
@@ -36,16 +38,28 @@ platform:
# build Configuration, i.e. Debug, Release, etc.
configuration:
- Release
- Debug
install:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
- set QTDIR=C:\Qt\5.15\msvc2019_64
- set PATH=%QTDIR%\bin;%PATH%
- sh: if [ "`uname -s`" = "Darwin" ]; then brew install ninja; else sudo apt-get -y install mesa-common-dev libglu1-mesa-dev; fi
before_build:
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
- cmd: set PATH=C:\Qt\5.15\msvc2019_64;%PATH%
- sh: if [ "`uname -s`" = "Darwin" ]; then export PATH=$HOME/Qt/5.15/clang_64/bin:$PATH; else export PATH=$HOME/Qt/5.15/gcc_64/bin:$PATH; fi
build_script:
- mkdir build
- cd build
- cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- nmake
- cmd: cmake -G Ninja -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- sh: cmake -G Ninja -DCMAKE_BUILD_TYPE=$CONFIGURATION -DKDDockWidgets_TESTS=True -DKDDockWidgets_EXAMPLES=True -DKDDockWidgets_DEVELOPER_MODE=True ..
- cmake --build .
- cmd: cmake --build . --target install
- sh: sudo cmake --build . --target install
- cmd: set PATH=.\bin;%PATH%
#temporarily disable testing on Windows
#- ctest --test-dir .
- sh: ctest --test-dir .
# to disable automatic builds
#build: off
@@ -54,11 +68,8 @@ build_script:
# tests configuration #
#---------------------------------#
test_script:
- nmake test
# to disable automatic tests
#test: off
test: off
#---------------------------------#

View File

@@ -203,7 +203,6 @@ function(ECM_GENERATE_PRI_FILE)
else()
set(PRI_TARGET_LIBS "${BASEPATH}/${EGPF_LIB_INSTALL_DIR}")
endif()
set(PRI_TARGET_DEFINES "")
set(PRI_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/qt_${PRI_TARGET_BASENAME}.pri)
if (EGPF_FILENAME_VAR)
@@ -211,6 +210,8 @@ function(ECM_GENERATE_PRI_FILE)
endif()
set(PRI_TARGET_MODULE_CONFIG "")
set(PRI_TARGET_DEFINES "")
set(PRI_TARGET_POSTFIX "")
# backward compat: it was not obvious LIB_NAME needs to be a target name,
# and some projects where the target name was not the actual library output name
# passed the output name for LIB_NAME, so .name & .module prperties are correctly set.
@@ -220,6 +221,10 @@ function(ECM_GENERATE_PRI_FILE)
if (target_type STREQUAL "STATIC_LIBRARY")
set(PRI_TARGET_MODULE_CONFIG "staticlib")
endif()
get_target_property(target_defs ${EGPF_LIB_NAME} INTERFACE_COMPILE_DEFINITIONS)
list(FILTER target_defs EXCLUDE REGEX ^QT_)
string(JOIN " " PRI_TARGET_DEFINES "${target_defs}")
set(PRI_TARGET_POSTFIX "$<TARGET_PROPERTY:${EGPF_LIB_NAME},$<UPPER_CASE:$<CONFIG>$<$<CONFIG:>:Debug>>_POSTFIX>")
endif()
file(GENERATE
@@ -230,8 +235,8 @@ QT.${PRI_TARGET_BASENAME}.MAJOR_VERSION = ${PRI_VERSION_MAJOR}
QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PRI_VERSION_MINOR}
QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PRI_VERSION_PATCH}
QT.${PRI_TARGET_BASENAME}.name = ${PRI_TARGET_LIBNAME}
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}
QT.${PRI_TARGET_BASENAME}.defines = ${PRI_TARGET_DEFINES}
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}${PRI_TARGET_POSTFIX}
QT.${PRI_TARGET_BASENAME}.DEFINES = ${PRI_TARGET_DEFINES}
QT.${PRI_TARGET_BASENAME}.includes = ${PRI_TARGET_INCLUDES}
QT.${PRI_TARGET_BASENAME}.private_includes =
QT.${PRI_TARGET_BASENAME}.libs = ${PRI_TARGET_LIBS}

View File

@@ -19,6 +19,10 @@ endif()
#Qt5 requires C++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#remove noisy compiler warnings (as the generated code is not necessarily super-warning-free)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all -Wno-extra")
endif()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)

View File

@@ -19,6 +19,10 @@ endif()
#Qt6 requires C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#remove noisy compiler warnings (as the generated code is not necessarily super-warning-free)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all -Wno-extra")
endif()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK)

View File

@@ -11,7 +11,7 @@ from conans import ConanFile, CMake, tools
class KDDockWidgetsConan(ConanFile):
name = "kddockwidgets"
version = "1.4.0"
version = "1.5.0"
default_user = "kdab"
default_channel = "stable"
license = ("https://raw.githubusercontent.com/KDAB/KDDockWidgets/master/LICENSES/GPL-2.0-only.txt",

View File

@@ -1,3 +1,9 @@
kddockwidgets (1.5.0) release candidate; urgency=high
* 1.5.0 final
-- Allen Winter <allen.winter@kdab.com> Mon, 24 Nov 2021 12:00:00 -0500
kddockwidgets (1.4.0) release candidate; urgency=high
* 1.4.0 final

View File

@@ -6,7 +6,7 @@ Build-Depends: debhelper (>=9), cdbs, cmake
Standards-Version: 3.9.6
Homepage: https://github.com/KDAB/KDDockWidgets
Package: kddockwidgets
Package: qt5-kddockwidgets
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: KDAB's Dock Widget Framework for Qt
Description: KDAB's Dock Widget Framework for Qt

View File

@@ -1,10 +1,10 @@
Format: 1.0
Source: kddockwidgets
Version: 1.4.0-1
Version: 1.5.0-1
Binary: kddockwidgets
Maintainer: Allen Winter <allen.winter@kdab.com>
Architecture: any
Build-Depends: debhelper (>=9), cdbs, cmake, qtbase5-dev, libqt5x11extras5-dev
Build-Depends: debhelper (>=9), cdbs, cmake, qtbase5-dev, qtbase5-private-dev, libqt5x11extras5-dev, libfontconfig-dev
Files:
00000000000000000000000000000000 00000 qt5-kddockwidgets-1.4.0.tar.gz
00000000000000000000000000000000 00000 qt5-kddockwidgets-1.5.0.tar.gz

View File

@@ -1,5 +1,5 @@
Name: qt5-kddockwidgets
Version: 1.4.0
Version: 1.5.0
Release: 1
Summary: KDAB's Dock Widget Framework for Qt5
Source0: %{name}-%{version}.tar.gz
@@ -14,15 +14,15 @@ Packager: Klaralvdalens Datakonsult AB (KDAB) <info@kdab.com>
BuildRequires: cmake
%if %{defined suse_version}
BuildRequires: libqt5-qtbase-devel libqt5-qtx11extras-devel
BuildRequires: libqt5-qtbase-devel libqt5-qtbase-private-headers-devel libqt5-qtx11extras-devel
%endif
%if %{defined fedora}
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtx11extras-devel desktop-file-utils
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtx11extras-devel desktop-file-utils
%endif
%if %{defined rhel}
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtx11extras-devel desktop-file-utils
BuildRequires: gcc-c++ qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtx11extras-devel desktop-file-utils
%endif
%description
@@ -98,6 +98,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
%{_libdir}/libkddockwidgets.so
%changelog
* Mon Nov 24 2021 Allen Winter <allen.winter@kdab.com> 1.5.0
1.5.0 final
* Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0
1.4.0 final
* Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1

12
distro/qt6-debian.control Normal file
View File

@@ -0,0 +1,12 @@
Source: kddockwidgets
Section: Miscellaneous
Priority: optional
Maintainer: Allen Winter <allen.winter@kdab.com>
Build-Depends: debhelper (>=9), cdbs, cmake
Standards-Version: 3.9.6
Homepage: https://github.com/KDAB/KDDockWidgets
Package: qt6-kddockwidgets
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: KDAB's Dock Widget Framework for Qt

View File

@@ -1,10 +1,10 @@
Format: 1.0
Source: kddockwidgets
Version: 1.4.0-1
Version: 1.5.0-1
Binary: kddockwidgets
Maintainer: Allen Winter <allen.winter@kdab.com>
Architecture: any
Build-Depends: debhelper (>=9), cdbs, cmake, qtbase6-dev, libqt6x11extras5-dev
Build-Depends: debhelper (>=9), cdbs, cmake, qtbase6-dev, qtbase6-private-dev, libqt6x11extras5-dev, libfontconfig-dev
Files:
00000000000000000000000000000000 00000 qt6-kddockwidgets-1.4.0.tar.gz
00000000000000000000000000000000 00000 qt6-kddockwidgets-1.5.0.tar.gz

View File

@@ -1,5 +1,5 @@
Name: qt6-kddockwidgets
Version: 1.4.0
Version: 1.5.0
Release: 1
Summary: KDAB's Dock Widget Framework for Qt6
Source0: %{name}-%{version}.tar.gz
@@ -14,15 +14,15 @@ Packager: Klaralvdalens Datakonsult AB (KDAB) <info@kdab.com>
BuildRequires: cmake
%if %{defined suse_version}
BuildRequires: libqt6-qtbase-devel libqt6-qtx11extras-devel
BuildRequires: libqt6-qtbase-devel libqt6-qtbase-private-headers-devel libqt6-qtx11extras-devel
%endif
%if %{defined fedora}
BuildRequires: gcc-c++ qt6-qtbase-devel desktop-file-utils
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel desktop-file-utils libxkbcommon-devel
%endif
%if %{defined rhel}
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtx11extras-devel desktop-file-utils
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel qt6-qtx11extras-devel desktop-file-utils libxkbcommon-devel
%endif
%description
@@ -87,6 +87,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=
#%{_prefix}/mkspecs/modules/* ECMGeneratePriFile isn't ported to Qt6 yet
%changelog
* Mon Nov 24 2021 Allen Winter <allen.winter@kdab.com> 1.5.0
1.5.0 final
* Fri Jul 16 2021 Allen Winter <allen.winter@kdab.com> 1.4.0
1.4.0 final
* Mon Jun 07 2021 Allen Winter <allen.winter@kdab.com> 1.3.1

View File

@@ -39,4 +39,6 @@ set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${${PROJECT_NAME}_PYTHON_BIN
include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
add_subdirectory(PyKDDockWidgets)
add_subdirectory(tests)
if(${PROJECT_NAME}_TESTS)
add_subdirectory(tests)
endif()

View File

@@ -18,10 +18,13 @@ def setupLibraryPath():
if sys.platform != 'win32':
return
from shiboken2 import shiboken2
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
if "@PYSIDE_MAJOR_VERSION@" == "6":
from shiboken@PYSIDE_MAJOR_VERSION@ import Shiboken
else:
from shiboken@PYSIDE_MAJOR_VERSION@ import shiboken@PYSIDE_MAJOR_VERSION@ as Shiboken
extra_dll_dirs = [ os.path.abspath(os.path.dirname(shiboken2.__file__)),
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
extra_dll_dirs = [ os.path.abspath(os.path.dirname(Shiboken.__file__)),
os.path.abspath(os.path.dirname(QtCore.__file__)),
os.path.abspath(os.path.dirname(__file__)) ]

View File

@@ -15,7 +15,10 @@ from MyMainWindow import MyMainWindow
from PySide6 import QtWidgets, QtCore
import sys
#import rc_assets
try:
import rc_assets
except:
exit("Oops.. rc_assets needs to be generated first.\nPlease run:\n rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc\n(Make sure to use the rcc from the Qt6 version used to generate the bindings!)")
if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)

View File

@@ -15,7 +15,10 @@ from MyMainWindow import MyMainWindow
from PySide2 import QtWidgets, QtCore
import sys
import rc_assets
try:
import rc_assets
except:
exit("Oops.. rc_assets needs to be generated first.\nPlease run:\n rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc\n(Make sure to use the rcc from the Qt5 version used to generate the bindings!)")
if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)

View File

@@ -12,7 +12,7 @@ import os
import sys
class TstConfig(object):
bindingsNamespace = "@PYTHON_BINDING_NAMESPACE@"
bindingsNamespace = "PyKDDockWidgets"
def initLibraryPath():
if sys.platform == 'win32' and sys.version_info[0] == 3 and sys.version_info[1] >= 8:

View File

@@ -61,6 +61,9 @@ public:
~Config();
///@brief Flag enum to tune certain behaviours, the defaults are Flag_Default
///@warning Only the default is supported on all platforms. Not all options work with all window managers,
/// Qt does its best to abstract the differences however that's only a best effort. This is true specially
/// for any option that changes window flags.
enum Flag
{
Flag_None = 0, ///< No option set
@@ -113,8 +116,9 @@ public:
InternalFlag_DontUseQtToolWindowsForFloatingWindows = 4, ///< FloatingWindows will use Qt::Window instead of Qt::Tool.
InternalFlag_DontShowWhenUnfloatingHiddenWindow = 8, ///< DockWidget::setFloating(false) won't do anything if the window is hidden.
InternalFlag_UseTransparentFloatingWindow = 16, ///< For QtQuick only. Allows to have round-corners. It's flaky when used with native Windows drop-shadow.
InternalFlag_DisableTranslucency = 32 ///< KDDW tries to detect if your Window Manager doesn't support transparent windows, but the detection might fail
/// with more exotic setups. This flag can be used to override.
InternalFlag_DisableTranslucency = 32, ///< KDDW tries to detect if your Window Manager doesn't support transparent windows, but the detection might fail
/// with more exotic setups. This flag can be used to override.
InternalFlag_TopLevelIndicatorRubberBand = 64 ///< Makes the rubber band of classic drop indicators to be top-level windows. Helps with working around MFC bugs
};
Q_DECLARE_FLAGS(InternalFlags, InternalFlag)

View File

@@ -732,10 +732,9 @@ void DockWidgetBase::Private::show()
void DockWidgetBase::onParentChanged()
{
#ifdef KDDOCKWIDGETS_QTWIDGETS
// TODO: In v1.4, remove this part and use the signal emitting the arg
Q_EMIT parentChanged();
#else
Q_EMIT parentChanged(this);
Q_EMIT QQuickItem::parentChanged(parentItem());
#endif
d->updateToggleAction();
d->updateFloatAction();

View File

@@ -457,6 +457,7 @@ public:
Q_SIGNALS:
#ifdef KDDOCKWIDGETS_QTWIDGETS
///@brief signal emitted when the parent changed
/// QtQuick already has QQuickItem::parentChanged(), so add it only for QtWidgets here.
void parentChanged();
#endif

View File

@@ -219,6 +219,7 @@ bool LayoutSaver::restoreLayout(const QByteArray &data)
layout.scaleSizes(d->m_restoreOptions);
d->floatWidgetsWhichSkipRestore(layout.mainWindowNames());
d->floatUnknownWidgets(layout);
Private::RAIIIsRestoring isRestoring;
@@ -376,6 +377,22 @@ void LayoutSaver::Private::floatWidgetsWhichSkipRestore(const QStringList &mainW
}
}
void LayoutSaver::Private::floatUnknownWidgets(const LayoutSaver::Layout &layout)
{
// An old *.json layout file might have not know about existing dock widgets
// When restoring such a file, we need to float any visible dock widgets which it doesn't know about
// so we can restore the MainWindow layout properly
for (MainWindowBase *mw : DockRegistry::self()->mainWindows(layout.mainWindowNames())) {
const KDDockWidgets::DockWidgetBase::List docks = mw->layoutWidget()->dockWidgets();
for (DockWidgetBase *dw : docks) {
if (!layout.containsDockWidget(dw->uniqueName())) {
dw->setFloating(true);
}
}
}
}
void LayoutSaver::Private::deleteEmptyFrames()
{
// After a restore it can happen that some DockWidgets didn't exist, so weren't restored.
@@ -593,6 +610,14 @@ QStringList LayoutSaver::Layout::dockWidgetsToClose() const
return names;
}
bool LayoutSaver::Layout::containsDockWidget(const QString &uniqueName) const
{
return std::find_if(allDockWidgets.cbegin(), allDockWidgets.cend(), [uniqueName](const std::shared_ptr<LayoutSaver::DockWidget> &dock) {
return dock->uniqueName == uniqueName;
})
!= allDockWidgets.cend();
}
bool LayoutSaver::Frame::isValid() const
{
if (isNull)
@@ -813,7 +838,7 @@ void LayoutSaver::MainWindow::scaleSizes()
return;
}
scalingInfo = ScalingInfo(uniqueName, geometry);
scalingInfo = ScalingInfo(uniqueName, geometry, screenIndex);
}
QVariantMap LayoutSaver::MainWindow::toVariantMap() const
@@ -988,7 +1013,7 @@ void LayoutSaver::Placeholder::fromVariantMap(const QVariantMap &map)
mainWindowUniqueName = map.value(QStringLiteral("mainWindowUniqueName")).toString();
}
LayoutSaver::ScalingInfo::ScalingInfo(const QString &mainWindowId, QRect savedMainWindowGeo)
LayoutSaver::ScalingInfo::ScalingInfo(const QString &mainWindowId, QRect savedMainWindowGeo, int screenIndex)
{
auto mainWindow = DockRegistry::self()->mainWindowByName(mainWindowId);
if (!mainWindow) {
@@ -1006,11 +1031,14 @@ LayoutSaver::ScalingInfo::ScalingInfo(const QString &mainWindowId, QRect savedMa
return;
}
const int currentScreenIndex = qApp->screens().indexOf(mainWindow->screen());
this->mainWindowName = mainWindowId;
this->savedMainWindowGeometry = savedMainWindowGeo;
realMainWindowGeometry = mainWindow->window()->geometry(); // window() as our main window might be embedded
widthFactor = double(realMainWindowGeometry.width()) / savedMainWindowGeo.width();
heightFactor = double(realMainWindowGeometry.height()) / savedMainWindowGeo.height();
mainWindowChangedScreen = currentScreenIndex != screenIndex;
}
void LayoutSaver::ScalingInfo::translatePos(QPoint &pt) const
@@ -1045,7 +1073,15 @@ void LayoutSaver::ScalingInfo::applyFactorsTo(QRect &rect) const
QSize size = rect.size();
applyFactorsTo(/*by-ref*/ size);
applyFactorsTo(/*by-ref*/ pos);
if (!mainWindowChangedScreen) {
// Don't play with floating window position if the main window changed screen.
// There's too many corner cases that push the floating windows out of bounds, and
// we're not even considering monitors with different HDPI. We can support only the simple case.
// For complex cases we'll try to guarantee the window is placed somewhere reasonable.
applyFactorsTo(/*by-ref*/ pos);
}
rect.moveTopLeft(pos);
rect.setSize(size);

View File

@@ -101,7 +101,7 @@ public:
*
* Example: kddockwidgets_example --central-widget
*/
Q_INVOKABLE void setPersistentCentralWidget(QWidgetOrQuick *widget);
Q_INVOKABLE void setPersistentCentralWidget(KDDockWidgets::QWidgetOrQuick *widget);
QWidgetOrQuick *persistentCentralWidget() const;
/**

View File

@@ -97,7 +97,7 @@ struct LayoutSaver::Placeholder
struct LayoutSaver::ScalingInfo
{
ScalingInfo() = default;
explicit ScalingInfo(const QString &mainWindowId, QRect savedMainWindowGeo);
explicit ScalingInfo(const QString &mainWindowId, QRect savedMainWindowGeo, int screenIndex);
bool isValid() const
{
@@ -114,6 +114,7 @@ struct LayoutSaver::ScalingInfo
QRect realMainWindowGeometry;
double heightFactor = -1;
double widthFactor = -1;
bool mainWindowChangedScreen = false;
};
struct LayoutSaver::Position
@@ -349,6 +350,7 @@ public:
QStringList mainWindowNames() const;
QStringList dockWidgetNames() const;
QStringList dockWidgetsToClose() const;
bool containsDockWidget(const QString &uniqueName) const;
int serializationVersion = KDDOCKWIDGETS_SERIALIZATION_VERSION;
LayoutSaver::MainWindow::List mainWindows;
@@ -375,6 +377,7 @@ public:
bool matchesAffinity(const QStringList &affinities) const;
void floatWidgetsWhichSkipRestore(const QStringList &mainWindowNames);
void floatUnknownWidgets(const LayoutSaver::Layout &layout);
template<typename T>
void deserializeWindowGeometry(const T &saved, QWidgetOrQuick *topLevel);

View File

@@ -285,7 +285,7 @@ bool TitleBar::supportsMinimizeButton() const
bool TitleBar::supportsAutoHideButton() const
{
// Only dock widgets docked into the MainWindow can minimize
return m_supportsAutoHide && m_frame && m_frame->isInMainWindow();
return m_supportsAutoHide && m_frame && (m_frame->isInMainWindow() || m_frame->isOverlayed());
}
bool TitleBar::hasIcon() const

View File

@@ -21,8 +21,6 @@
#include "private/DockRegistry_p.h"
#include "private/Utils_p.h"
// #define KDDOCKWIDGETS_RUBBERBAND_IS_TOPLEVEL 1
using namespace KDDockWidgets;
static IndicatorWindow *createIndicatorWindow(ClassicIndicators *classicIndicators)
@@ -221,11 +219,7 @@ void ClassicIndicators::updateWindowPosition()
bool ClassicIndicators::rubberBandIsTopLevel() const
{
#ifdef KDDOCKWIDGETS_RUBBERBAND_IS_TOPLEVEL
return true;
#else
return false;
#endif
return Config::self().internalFlags() & Config::InternalFlag_TopLevelIndicatorRubberBand;
}
QRect ClassicIndicators::geometryForRubberband(QRect localRect) const

View File

@@ -2107,7 +2107,7 @@ void ItemBoxContainer::dumpLayout(int level)
void ItemBoxContainer::updateChildPercentages()
{
if (d->m_blockUpdatePercentages)
if (root()->d->m_blockUpdatePercentages)
return;
const int usable = usableLength();

View File

@@ -754,6 +754,15 @@ bool QWidgetAdapter::eventFilter(QObject *watched, QEvent *ev)
return QQuickItem::eventFilter(watched, ev);
}
QScreen *QWidgetAdapter::screen() const
{
if (QQuickView *w = quickView()) {
return w->screen();
}
return nullptr;
}
void QWidgetAdapter::setWindowIsBeingDestroyed(bool is)
{
m_windowIsBeingDestroyed = is;

View File

@@ -193,6 +193,7 @@ public:
Q_INVOKABLE void showNormal();
Q_INVOKABLE void redirectMouseEvents(QObject *from);
QScreen *screen() const;
QQuickView *quickView() const;
QWindow *windowHandle() const;
QWidgetAdapter *window() const;

View File

@@ -69,7 +69,10 @@ static bool shouldBlacklistWarning(const QString &msg, const QString &category)
#ifdef KDDOCKWIDGETS_QTQUICK
// TODO: Fix later, not important right now
|| msg.contains(QLatin1String("Binding loop detected for property"))
|| msg.contains(QLatin1String("Implement me"))
|| msg.contains(QLatin1String("Implement me"))
// Ignore benign warning in Material style when deleting a dock widget. Should be fixed in Qt.
|| (msg.contains(QLatin1String("TypeError: Cannot read property")) && msg.contains(QLatin1String("Material")))
#endif
;
}

View File

@@ -619,28 +619,6 @@ void TestDocks::tst_restoreMaximizedState()
QCOMPARE(m->windowHandle()->windowState(), Qt::WindowMaximized);
}
void TestDocks::tst_restoreFloatingMaximizedState()
{
EnsureTopLevelsDeleted e;
KDDockWidgets::Config::self().setFlags(KDDockWidgets::Config::Flag_TitleBarHasMaximizeButton);
auto dock1 = createDockWidget("dock1", new MyWidget("one"));
const QRect originalNormalGeometry = dock1->floatingWindow()->normalGeometry();
dock1->floatingWindow()->showMaximized();
qDebug() << originalNormalGeometry;
QCOMPARE(dock1->floatingWindow()->windowHandle()->windowState(), Qt::WindowMaximized);
LayoutSaver saver;
const QByteArray saved = saver.serializeLayout();
saver.restoreLayout(saved);
QCOMPARE(dock1->floatingWindow()->windowHandle()->windowState(), Qt::WindowMaximized);
QCOMPARE(dock1->floatingWindow()->normalGeometry(), originalNormalGeometry);
dock1->floatingWindow()->showNormal();
QCOMPARE(dock1->floatingWindow()->normalGeometry(), originalNormalGeometry);
}
void TestDocks::tst_restoreFloatingMinimizedState()
{
EnsureTopLevelsDeleted e;
@@ -656,6 +634,36 @@ void TestDocks::tst_restoreFloatingMinimizedState()
QCOMPARE(dock1->floatingWindow()->windowHandle()->windowState(), Qt::WindowMinimized);
}
void TestDocks::tst_restoreNonExistingDockWidget()
{
// If the layout is old and doesn't know about some dock widget, then we need to float it
// before restoring the MainWindow's layout
QByteArray saved;
const QSize defaultMainWindowSize = { 500, 500 };
{
EnsureTopLevelsDeleted e;
auto m = createMainWindow(defaultMainWindowSize, MainWindowOption_None, "mainwindow1");
LayoutSaver saver;
saved = saver.serializeLayout();
}
EnsureTopLevelsDeleted e;
auto m = createMainWindow(defaultMainWindowSize, MainWindowOption_None, "mainwindow1");
auto dock2 = createDockWidget("dock2", new MyWidget("dock2"));
m->addDockWidget(dock2, Location_OnBottom);
LayoutSaver restorer;
SetExpectedWarning sew("Couldn't find dock widget");
QVERIFY(restorer.restoreLayout(saved));
auto da = m->dropArea();
QVERIFY(m->dropArea()->checkSanity());
QCOMPARE(da->frames().size(), 0);
QVERIFY(dock2->isOpen());
QVERIFY(dock2->isFloating());
}
void TestDocks::tst_setFloatingSimple()
{
EnsureTopLevelsDeleted e;
@@ -867,6 +875,31 @@ void TestDocks::tst_shutdown()
#ifdef KDDOCKWIDGETS_QTWIDGETS
void TestDocks::tst_restoreFloatingMaximizedState()
{
EnsureTopLevelsDeleted e;
KDDockWidgets::Config::self().setFlags(KDDockWidgets::Config::Flag_TitleBarHasMaximizeButton);
auto dock1 = createDockWidget("dock1", new MyWidget("one"));
const QRect originalNormalGeometry = dock1->floatingWindow()->normalGeometry();
dock1->floatingWindow()->showMaximized();
qDebug() << originalNormalGeometry;
QCOMPARE(dock1->floatingWindow()->windowHandle()->windowState(), Qt::WindowMaximized);
LayoutSaver saver;
const QByteArray saved = saver.serializeLayout();
saver.restoreLayout(saved);
QCOMPARE(dock1->floatingWindow()->windowHandle()->windowState(), Qt::WindowMaximized);
QCOMPARE(dock1->floatingWindow()->normalGeometry(), originalNormalGeometry);
dock1->floatingWindow()->showNormal();
QCOMPARE(dock1->floatingWindow()->normalGeometry(), originalNormalGeometry);
}
void TestDocks::tst_complex()
{
// Tests some anchors out of bounds I got
@@ -4102,12 +4135,14 @@ void TestDocks::tst_dragOverTitleBar()
DropArea *da = dock1->floatingWindow()->dropArea();
FloatingWindow *fw1 = dock1->floatingWindow();
FloatingWindow *fw2 = dock2->floatingWindow();
WindowBeingDragged wbd(fw2, fw2);
{
WindowBeingDragged wbd(fw2, fw2);
const QPoint titleBarPoint = fw1->titleBar()->mapToGlobal(QPoint(5, 5));
const QPoint titleBarPoint = fw1->titleBar()->mapToGlobal(QPoint(5, 5));
auto loc = da->hover(&wbd, titleBarPoint);
QCOMPARE(loc, DropIndicatorOverlayInterface::DropLocation_None);
auto loc = da->hover(&wbd, titleBarPoint);
QCOMPARE(loc, DropIndicatorOverlayInterface::DropLocation_None);
}
delete fw1;
delete fw2;
@@ -5223,6 +5258,31 @@ void TestDocks::tst_deleteOnCloseWhenOnSideBar()
QVERIFY(dock1);
}
void TestDocks::tst_sidebarOverlayShowsAutohide()
{
// Tests that overlayed widgets show the "Disable auto-hide" button
EnsureTopLevelsDeleted e;
KDDockWidgets::Config::self().setFlags(KDDockWidgets::Config::Flag_AutoHideSupport);
auto m1 = createMainWindow(QSize(1000, 1000), MainWindowOption_None, "MW1");
auto dw1 = new DockWidgetType(QStringLiteral("1"));
m1->addDockWidget(dw1, Location_OnBottom);
QVERIFY(dw1->titleBar()->supportsAutoHideButton());
m1->moveToSideBar(dw1);
m1->overlayOnSideBar(dw1);
QVERIFY(dw1->isOverlayed());
auto titleBar = dw1->titleBar();
QVERIFY(titleBar->isVisible());
QVERIFY(titleBar->supportsAutoHideButton());
delete dw1;
}
void TestDocks::tst_sidebarOverlayGetsHiddenOnClick()
{
EnsureTopLevelsDeleted e;
@@ -5482,7 +5542,9 @@ void TestDocks::tst_restoreNonRelativeFloatingWindowGeometry()
EnsureTopLevelsDeleted e;
auto m = createMainWindow(QSize(500, 500), MainWindowOption_None);
auto dock1 = createDockWidget("1", new QPushButton("1"));
dock1->show();
// Also test that invisible dock doesn't change size
auto dock2 = createDockWidget("2", new QPushButton("2"), {}, {}, /*show=*/false);
LayoutSaver saver(RestoreOption_RelativeToMainWindow);
saver.dptr()->m_restoreOptions.setFlag(InternalRestoreOption::RelativeFloatingWindowGeometry,
@@ -5491,11 +5553,16 @@ void TestDocks::tst_restoreNonRelativeFloatingWindowGeometry()
const QByteArray saved = saver.serializeLayout();
const QSize floatingWindowSize = dock1->window()->size();
const QSize floatingWindowSize2 = dock2->window()->size();
m->resize(m->width() * 2, m->height());
saver.restoreLayout(saved);
QVERIFY(dock2->isFloating());
QVERIFY(!dock2->isOpen());
QCOMPARE(dock1->window()->size(), floatingWindowSize);
QCOMPARE(dock2->window()->size(), floatingWindowSize2);
}
void TestDocks::tst_maximumSizePolicy()
@@ -7290,6 +7357,31 @@ void TestDocks::tst_toggleTabbed2()
QCOMPARE(frame1->title(), "dock1");
}
void TestDocks::tst_resizePropagatesEvenly()
{
// For github issue #186
// Usually resizing main window will resize dock widgets evenly, but if you resize multiple
// times then one dock widget is getting too small. Not repro with all layouts, but the following
// one reproduced it:
auto m = createMainWindow(QSize(1000, 1000), MainWindowOption_None);
auto dock0 = createDockWidget("dock0", new MyWidget2());
auto dock1 = createDockWidget("dock1", new MyWidget2());
auto dock2 = createDockWidget("dock2", new MyWidget2());
m->addDockWidget(dock1, Location_OnLeft);
m->addDockWidget(dock2, Location_OnTop, dock1);
m->addDockWidget(dock0, Location_OnRight);
QVERIFY(qAbs(dock2->height() - dock1->height()) < 2);
m->resize(m->size() + QSize(0, 500));
for (int i = 1; i < 10; ++i)
m->resize(m->size() - QSize(0, i));
QVERIFY(qAbs(dock2->height() - dock1->height()) < 3);
}
void TestDocks::tst_addMDIDockWidget()
{
EnsureTopLevelsDeleted e;
@@ -7377,6 +7469,25 @@ void TestDocks::tst_closeTabOfCentralFrame()
QVERIFY(frame->QWidgetAdapter::isVisible());
}
void TestDocks::tst_centralFrame245()
{
/*
Build: -DKDDockWidgets_DEVELOPER_MODE=ON
Run: ./bin/tst_docks tst_centralFrame245 -platform xcb
auto m = createMainWindow(QSize(500, 500), MainWindowOption_HasCentralFrame, "tst_centralFrame245");
auto dock1 = createDockWidget("1", new QPushButton("1"));
auto dock2 = createDockWidget("2", new QPushButton("2"));
m->addDockWidgetAsTab(dock1);
m->addDockWidgetAsTab(dock2);
QTest::qWait(100000);
*/
}
void TestDocks::tst_persistentCentralWidget()
{
EnsureTopLevelsDeleted e;

View File

@@ -91,8 +91,8 @@ private Q_SLOTS:
void tst_restoreEmpty();
void tst_restoreCentralFrame();
void tst_restoreMaximizedState();
void tst_restoreFloatingMaximizedState();
void tst_restoreFloatingMinimizedState();
void tst_restoreNonExistingDockWidget();
void tst_shutdown();
void tst_closeDockWidgets();
void tst_layoutEqually();
@@ -152,6 +152,7 @@ private Q_SLOTS:
void tst_availableLengthForOrientation();
void tst_closeShowWhenNoCentralFrame();
void tst_closeTabOfCentralFrame();
void tst_centralFrame245();
void tst_setAsCurrentTab();
void tst_placeholderDisappearsOnReadd();
void tst_placeholdersAreRemovedProperly();
@@ -238,6 +239,7 @@ private Q_SLOTS:
void tst_redocksToPreviousTabIndex();
void tst_toggleTabbed();
void tst_toggleTabbed2();
void tst_resizePropagatesEvenly();
void tst_addMDIDockWidget();
void tst_redockToMDIRestoresPosition();
@@ -259,6 +261,7 @@ private Q_SLOTS:
void tst_restoreSideBar();
void tst_toggleActionOnSideBar();
void tst_deleteOnCloseWhenOnSideBar();
void tst_sidebarOverlayShowsAutohide();
void tst_sidebarOverlayGetsHiddenOnClick();
void tst_floatRemovesFromSideBar();
void tst_overlayedGeometryIsSaved();
@@ -279,6 +282,7 @@ private Q_SLOTS:
void tst_addToHiddenMainWindow();
void tst_maximumSizePolicy();
void tst_complex();
void tst_restoreFloatingMaximizedState();
#else
void tst_hoverShowsDropIndicators();
#endif