Compare commits

...

28 Commits

Author SHA1 Message Date
Allen Winter
e5857df439 conan/conanfile.py - upgrade version number 2021-02-06 10:09:32 -05:00
Allen Winter
42d25dc1a5 fwd_headers/kddockwidgets/KDDockWidgets.h - update copyright year 2021-02-06 10:07:55 -05:00
Sergio Martins
3b5e78bfba ChangeLog: Add release date of 1.2.1 2021-02-06 13:02:50 +00:00
Sergio Martins
639dce7c53 Remove the QtQuick presets from the 1.2 branch
It's for master only
2021-02-06 12:46:18 +00:00
Sergio Martins
882f54647c ChangeLog removed mention to 1.3 from the 1.2 branch 2021-02-06 12:43:56 +00:00
Sergio Martins
621c3dbeca Also clear the overlay internals when floating an overlay
Fixes a crash.

Relates to #162
2021-02-05 16:32:41 +00:00
Sergio Martins
f1e4f7ecda Add another test 2021-02-05 14:34:12 +00:00
Sergio Martins
249d1b6790 Remove from the sidebar when floating a widget
Fixes #162
2021-02-05 12:35:03 +00:00
Sergio Martins
894e0fd03a Added test for issue #162 2021-02-05 11:49:52 +00:00
Allen Winter
ec1f009914 CLA - switch to a form-fillable PDF version 2021-02-04 16:26:34 -05:00
Sergio Martins
7caa83be19 Also hide overlay when clicking on empty space of a main window 2021-02-04 19:56:35 +00:00
Sergio Martins
e745d38b1e Improve the test a bit
clicking on the bottom is not very effective as that's where the
bottom sidebar is
2021-02-04 19:52:21 +00:00
Sergio Martins
6d389315bf Add test for issue #157 2021-02-04 19:31:31 +00:00
Sergio Martins
daec97ad66 Don't require QtX11Extras for WASM
Fixes #163
2021-02-04 13:30:04 +00:00
Sergio Martins
9a38626af5 Allow more private includes to be used from installed dir 2021-01-27 23:31:59 +00:00
Sergio Martins
f0c243f6d1 Add KDDockWidgets.h fwd_header 2021-01-27 23:27:04 +00:00
Sergio Martins
f0441f1a08 Normalize some dock_exports.h includes
In case these files are ever included from an installed location
2021-01-27 23:00:32 +00:00
Sergio Martins
db06c496cf Remove dependencies to LayoutSaver_p.h
Only the impl needs to include it
2021-01-27 22:51:41 +00:00
Sergio Martins
2aa97e6565 Add a fwd header for DragController_p.h 2021-01-27 22:28:57 +00:00
Sergio Martins
68597cac22 install two more private includes 2021-01-27 22:27:46 +00:00
Allen Winter
802bdc102f src/CMakeLists.txt - fix Windows library versioning
was broken for RelWithDebInfo builds
2021-01-27 11:55:51 -05:00
Sergio Martins
723c29e33b Merge pull request #119 from JPatriceR/add-LayoutSaver-python-binding
Add binding for LayoutSaver class
2021-01-26 14:58:56 +00:00
Sergio Martins
4bede063ae Make DockWidgetBase::eventFilter() protected
The users might want to override it

Fixes #148 and restores source compat with v1.1
2021-01-26 14:25:30 +00:00
Jean-Patrice Laude
67b48cc417 Add binding for LayoutSaver class 2021-01-20 16:53:32 +01:00
Sergio Martins
de068dc6ff Use less relative includes, some of them were wrong
The example now includes them, so we can detect build failures
if they get wrong again

Fixes #140
2021-01-18 18:57:15 +00:00
Allen Winter
312c89f884 src/CMakeLists.txt - fix kddockwidgets_version.h install destination 2021-01-18 10:14:37 -05:00
Renato Araujo Oliveira Filho
d9fd7eb3a5 Fix python bindings build
Task-Id: KDABCI-692
2021-01-18 10:10:51 -05:00
Allen Winter
1a2757b00a Generate and install kddockwidgets_version.h
defines a version string and other useful versioning macros

Issue#138
2021-01-18 10:03:21 -05:00
42 changed files with 458 additions and 112 deletions

View File

@@ -34,28 +34,6 @@
"CMAKE_BUILD_TYPE": "Release" "CMAKE_BUILD_TYPE": "Release"
} }
}, },
{
"name": "qtquick",
"displayName": "qtquick",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-qtquick",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "dev-qtquick",
"displayName": "dev-qtquick",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-qtquick",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QTQUICK": "ON",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'"
}
},
{ {
"name": "python", "name": "python",
"displayName": "python", "displayName": "python",
@@ -76,17 +54,6 @@
"KDDockWidgets_STATIC": "ON" "KDDockWidgets_STATIC": "ON"
} }
}, },
{
"name": "static-qtquick",
"displayName": "static-qtquick",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-static-qtquick",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_STATIC": "ON",
"KDDockWidgets_QTQUICK": "ON"
}
},
{ {
"name": "qtwidgets6", "name": "qtwidgets6",
"displayName": "qtwidgets6", "displayName": "qtwidgets6",
@@ -114,20 +81,6 @@
"environment": { "environment": {
"PATH": "$env{HOME}/Qt/6.0.0/gcc_64/bin:$penv{PATH}" "PATH": "$env{HOME}/Qt/6.0.0/gcc_64/bin:$penv{PATH}"
} }
},
{
"name": "qtquick6",
"displayName": "qtquick6",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-qtquick6",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QTQUICK": "ON",
"KDDockWidgets_QT6": "ON"
},
"environment": {
"PATH": "$env{HOME}/Qt/6.0.0/gcc_64/bin:$penv{PATH}"
}
} }
] ]
} }

View File

@@ -1,9 +1,11 @@
* v1.3.0 (unreleased) * v1.2.1 (6 February 2021)
- [TODO] QtQuick support
* v1.2.1 (unreleased)
- Support for resizing dock widgets when they are in overlay/popup mode (autohide/sidebar feature) - Support for resizing dock widgets when they are in overlay/popup mode (autohide/sidebar feature)
- Fixed title bar close button enabled state not being restored with Layout saver (#137) - Fixed title bar close button enabled state not being restored with Layout saver (#137)
- Installs a version header (kddockwidgets_version.h) that defines a version string and other useful versioning macros (#138)
- DockWidgetBase::eventFilter() is protected instead of private (regression vs v1.1) (#148)
It's recommended that you rebuild your application when updating KDDW, as MSVC encodes private/protected in the name mangling.
- Fixed WASM build on Windows (#163)
- Fixed sidebar overlay not getting hidden when clicking on the main window docking area (#157)
* v1.2.0 (17 December 2020) * v1.2.0 (17 December 2020)
- Wayland support - Wayland support

View File

@@ -168,7 +168,7 @@ Contact KDAB at <info@kdab.com> to inquire about commercial licensing.
Get Involved Get Involved
============ ============
KDAB will happily accept external contributions; however, **all** contributions require a KDAB will happily accept external contributions; however, **all** contributions require a
signed [Copyright Assignment Agreement](docs/KDDockWidgets-CopyrightAssignmentForm.docx). signed [Copyright Assignment Agreement](docs/KDDockWidgets-CopyrightAssignmentForm.pdf).
Contact info@kdab.com for more information. Contact info@kdab.com for more information.

View File

@@ -0,0 +1,202 @@
#.rst:
# ECMSetupVersion
# ---------------
#
# Handle library version information.
#
# ::
#
# ecm_setup_version(<version>
# VARIABLE_PREFIX <prefix>
# [SOVERSION <soversion>]
# [VERSION_HEADER <filename>]
# [PACKAGE_VERSION_FILE <filename> [COMPATIBILITY <compat>]] )
#
# This parses a version string and sets up a standard set of version variables.
# It can optionally also create a C version header file and a CMake package
# version file to install along with the library.
#
# If the ``<version>`` argument is of the form ``<major>.<minor>.<patch>``
# (or ``<major>.<minor>.<patch>.<tweak>``), The following CMake variables are
# set::
#
# <prefix>_VERSION_MAJOR - <major>
# <prefix>_VERSION_MINOR - <minor>
# <prefix>_VERSION_PATCH - <patch>
# <prefix>_VERSION - <version>
# <prefix>_VERSION_STRING - <version> (for compatibility: use <prefix>_VERSION instead)
# <prefix>_SOVERSION - <soversion>, or <major> if SOVERSION was not given
#
# If CMake policy CMP0048 is not NEW, the following CMake variables will also
# be set::
#
# PROJECT_VERSION_MAJOR - <major>
# PROJECT_VERSION_MINOR - <minor>
# PROJECT_VERSION_PATCH - <patch>
# PROJECT_VERSION - <version>
# PROJECT_VERSION_STRING - <version> (for compatibility: use PROJECT_VERSION instead)
#
# If the VERSION_HEADER option is used, a simple C header is generated with the
# given filename. If filename is a relative path, it is interpreted as relative
# to CMAKE_CURRENT_BINARY_DIR. The generated header contains the following
# macros::
#
# <prefix>_VERSION_MAJOR - <major> as an integer
# <prefix>_VERSION_MINOR - <minor> as an integer
# <prefix>_VERSION_PATCH - <patch> as an integer
# <prefix>_VERSION_STRING - <version> as a C string
# <prefix>_VERSION - the version as an integer
#
# ``<prefix>_VERSION`` has ``<patch>`` in the bottom 8 bits, ``<minor>`` in the
# next 8 bits and ``<major>`` in the remaining bits. Note that ``<patch>`` and
# ``<minor>`` must be less than 256.
#
# If the PACKAGE_VERSION_FILE option is used, a simple CMake package version
# file is created using the write_basic_package_version_file() macro provided by
# CMake. It should be installed in the same location as the Config.cmake file of
# the library so that it can be found by find_package(). If the filename is a
# relative path, it is interpreted as relative to CMAKE_CURRENT_BINARY_DIR. The
# optional COMPATIBILITY option is forwarded to
# write_basic_package_version_file(), and defaults to AnyNewerVersion.
#
# If CMake policy CMP0048 is NEW, an alternative form of the command is
# available::
#
# ecm_setup_version(PROJECT
# [VARIABLE_PREFIX <prefix>]
# [SOVERSION <soversion>]
# [VERSION_HEADER <filename>]
# [PACKAGE_VERSION_FILE <filename>] )
#
# This will use the version information set by the project() command.
# VARIABLE_PREFIX defaults to the project name. Note that PROJECT must be the
# first argument. In all other respects, it behaves like the other form of the
# command.
#
# Since pre-1.0.0.
#
# COMPATIBILITY option available since 1.6.0.
#=============================================================================
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
# SPDX-FileCopyrightText: 2012 Alexander Neundorf <neundorf@kde.org>
#
# SPDX-License-Identifier: BSD-3-Clause
include(CMakePackageConfigHelpers)
# save the location of the header template while CMAKE_CURRENT_LIST_DIR
# has the value we want
set(_ECM_SETUP_VERSION_HEADER_TEMPLATE "${CMAKE_CURRENT_LIST_DIR}/ECMVersionHeader.h.in")
function(ecm_setup_version _version)
set(options )
set(oneValueArgs VARIABLE_PREFIX SOVERSION VERSION_HEADER PACKAGE_VERSION_FILE COMPATIBILITY)
set(multiValueArgs )
cmake_parse_arguments(ESV "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(ESV_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to ECM_SETUP_VERSION(): \"${ESV_UNPARSED_ARGUMENTS}\"")
endif()
set(project_manages_version FALSE)
set(use_project_version FALSE)
# CMP0048 only exists in CMake 3.0.0 and later
if(CMAKE_VERSION VERSION_LESS 3.0.0)
set(project_version_policy "OLD")
else()
cmake_policy(GET CMP0048 project_version_policy)
endif()
if(project_version_policy STREQUAL "NEW")
set(project_manages_version TRUE)
if(_version STREQUAL "PROJECT")
set(use_project_version TRUE)
endif()
elseif(_version STREQUAL "PROJECT")
message(FATAL_ERROR "ecm_setup_version given PROJECT argument, but CMP0048 is not NEW")
endif()
set(should_set_prefixed_vars TRUE)
if(NOT ESV_VARIABLE_PREFIX)
if(use_project_version)
set(ESV_VARIABLE_PREFIX "${PROJECT_NAME}")
set(should_set_prefixed_vars FALSE)
else()
message(FATAL_ERROR "Required argument PREFIX missing in ECM_SETUP_VERSION() call")
endif()
endif()
if(use_project_version)
set(_version "${PROJECT_VERSION}")
set(_major "${PROJECT_VERSION_MAJOR}")
set(_minor "${PROJECT_VERSION_MINOR}")
set(_patch "${PROJECT_VERSION_PATCH}")
else()
string(REGEX REPLACE "^0*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major "${_version}")
string(REGEX REPLACE "^[0-9]+\\.0*([0-9]+)\\.[0-9]+.*" "\\1" _minor "${_version}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.0*([0-9]+).*" "\\1" _patch "${_version}")
endif()
if(NOT ESV_SOVERSION)
set(ESV_SOVERSION ${_major})
endif()
if(should_set_prefixed_vars)
set(${ESV_VARIABLE_PREFIX}_VERSION "${_version}")
set(${ESV_VARIABLE_PREFIX}_VERSION_MAJOR ${_major})
set(${ESV_VARIABLE_PREFIX}_VERSION_MINOR ${_minor})
set(${ESV_VARIABLE_PREFIX}_VERSION_PATCH ${_patch})
endif()
set(${ESV_VARIABLE_PREFIX}_SOVERSION ${ESV_SOVERSION})
if(NOT project_manages_version)
set(PROJECT_VERSION "${_version}")
set(PROJECT_VERSION_MAJOR "${_major}")
set(PROJECT_VERSION_MINOR "${_minor}")
set(PROJECT_VERSION_PATCH "${_patch}")
endif()
# compat
set(PROJECT_VERSION_STRING "${PROJECT_VERSION}")
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}")
if(ESV_VERSION_HEADER)
set(HEADER_PREFIX "${ESV_VARIABLE_PREFIX}")
set(HEADER_VERSION "${_version}")
set(HEADER_VERSION_MAJOR "${_major}")
set(HEADER_VERSION_MINOR "${_minor}")
set(HEADER_VERSION_PATCH "${_patch}")
configure_file("${_ECM_SETUP_VERSION_HEADER_TEMPLATE}" "${ESV_VERSION_HEADER}")
endif()
if(ESV_PACKAGE_VERSION_FILE)
if(NOT ESV_COMPATIBILITY)
set(ESV_COMPATIBILITY AnyNewerVersion)
endif()
write_basic_package_version_file("${ESV_PACKAGE_VERSION_FILE}" VERSION ${_version} COMPATIBILITY ${ESV_COMPATIBILITY})
endif()
if(should_set_prefixed_vars)
set(${ESV_VARIABLE_PREFIX}_VERSION_MAJOR "${${ESV_VARIABLE_PREFIX}_VERSION_MAJOR}" PARENT_SCOPE)
set(${ESV_VARIABLE_PREFIX}_VERSION_MINOR "${${ESV_VARIABLE_PREFIX}_VERSION_MINOR}" PARENT_SCOPE)
set(${ESV_VARIABLE_PREFIX}_VERSION_PATCH "${${ESV_VARIABLE_PREFIX}_VERSION_PATCH}" PARENT_SCOPE)
set(${ESV_VARIABLE_PREFIX}_VERSION "${${ESV_VARIABLE_PREFIX}_VERSION}" PARENT_SCOPE)
endif()
# always set the soversion
set(${ESV_VARIABLE_PREFIX}_SOVERSION "${${ESV_VARIABLE_PREFIX}_SOVERSION}" PARENT_SCOPE)
if(NOT project_manages_version)
set(PROJECT_VERSION "${PROJECT_VERSION}" PARENT_SCOPE)
set(PROJECT_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}" PARENT_SCOPE)
set(PROJECT_VERSION_MINOR "${PROJECT_VERSION_MINOR}" PARENT_SCOPE)
set(PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}" PARENT_SCOPE)
endif()
# always set the compatibility variables
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_STRING}" PARENT_SCOPE)
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}" PARENT_SCOPE)
endfunction()

View File

@@ -0,0 +1,17 @@
// This file was generated by ecm_setup_version(): DO NOT EDIT!
#ifndef @HEADER_PREFIX@_VERSION_H
#define @HEADER_PREFIX@_VERSION_H
#define @HEADER_PREFIX@_VERSION_STRING "@HEADER_VERSION@"
#define @HEADER_PREFIX@_VERSION_MAJOR @HEADER_VERSION_MAJOR@
#define @HEADER_PREFIX@_VERSION_MINOR @HEADER_VERSION_MINOR@
#define @HEADER_PREFIX@_VERSION_PATCH @HEADER_VERSION_PATCH@
#define @HEADER_PREFIX@_VERSION @HEADER_PREFIX@_VERSION_CHECK(@HEADER_PREFIX@_VERSION_MAJOR, @HEADER_PREFIX@_VERSION_MINOR, @HEADER_PREFIX@_VERSION_PATCH)
/*
for example: @HEADER_PREFIX@_VERSION >= @HEADER_PREFIX@_VERSION_CHECK(1, 2, 2))
*/
#define @HEADER_PREFIX@_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
#endif

View File

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

Binary file not shown.

View File

@@ -12,6 +12,11 @@
#include "MyFrameworkWidgetFactory.h" #include "MyFrameworkWidgetFactory.h"
#include <kddockwidgets/FrameworkWidgetFactory.h> #include <kddockwidgets/FrameworkWidgetFactory.h>
#include <kddockwidgets/private/widgets/FrameWidget_p.h>
#include <kddockwidgets/private/widgets/TabWidget_p.h>
#include <kddockwidgets/private/widgets/TabBarWidget_p.h>
#include <kddockwidgets/private/widgets/TabWidgetWidget_p.h>
#include <kddockwidgets/private/widgets/TitleBarWidget_p.h> #include <kddockwidgets/private/widgets/TitleBarWidget_p.h>
#include <kddockwidgets/private/multisplitter/Separator_qwidget.h> #include <kddockwidgets/private/multisplitter/Separator_qwidget.h>

View File

@@ -20,6 +20,8 @@ set(PyKDDockWidgets_SRC
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindowbase_wrapper.h ${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindowbase_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.h ${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_mainwindow_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_layoutsaver_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_layoutsaver_wrapper.h
# namespace wrapper # namespace wrapper
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_wrapper.h ${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_wrapper.h
@@ -59,6 +61,7 @@ set(PyKDDockWidgets_DEPENDS
${CMAKE_SOURCE_DIR}/src/DockWidget.h ${CMAKE_SOURCE_DIR}/src/DockWidget.h
${CMAKE_SOURCE_DIR}/src/MainWindowBase.h ${CMAKE_SOURCE_DIR}/src/MainWindowBase.h
${CMAKE_SOURCE_DIR}/src/MainWindow.h ${CMAKE_SOURCE_DIR}/src/MainWindow.h
${CMAKE_SOURCE_DIR}/src/LayoutSaver.h
) )
create_python_bindings( create_python_bindings(
@@ -78,4 +81,4 @@ create_python_bindings(
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py)
# install # install
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/PyKDDockWidgets) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/PyKDDockWidgets)

View File

@@ -25,3 +25,4 @@
#include <kddockwidgets/MainWindow.h> #include <kddockwidgets/MainWindow.h>
#include <kddockwidgets/DockWidgetBase.h> #include <kddockwidgets/DockWidgetBase.h>
#include <kddockwidgets/DockWidget.h> #include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/LayoutSaver.h>

View File

@@ -40,5 +40,6 @@
</object-type> </object-type>
<object-type name="DockWidget" /> <object-type name="DockWidget" />
<object-type name="LayoutSaver" />
</namespace-type> </namespace-type>
</typesystem> </typesystem>

View File

@@ -101,9 +101,11 @@ set(DOCKS_INSTALLABLE_INCLUDES
set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES set(DOCKS_INSTALLABLE_PRIVATE_INCLUDES
private/DragController_p.h private/DragController_p.h
private/Draggable_p.h private/Draggable_p.h
private/DropArea_p.h
private/DropIndicatorOverlayInterface_p.h private/DropIndicatorOverlayInterface_p.h
private/FloatingWindow_p.h private/FloatingWindow_p.h
private/Frame_p.h private/Frame_p.h
private/MultiSplitter_p.h
private/SideBar_p.h private/SideBar_p.h
private/TitleBar_p.h private/TitleBar_p.h
private/WindowBeingDragged_p.h private/WindowBeingDragged_p.h
@@ -262,12 +264,13 @@ set_target_properties(kddockwidgets PROPERTIES
#version libraries on Windows #version libraries on Windows
if(WIN32) if(WIN32)
set(postfix ${${PROJECT_NAME}_VERSION_MAJOR}) set(postfix ${${PROJECT_NAME}_VERSION_MAJOR})
set(CMAKE_RELEASE_POSTFIX ${postfix}) string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
set_target_properties(kddockwidgets PROPERTIES RELEASE_POSTFIX ${CMAKE_RELEASE_POSTFIX}) if(${UPPER_BUILD_TYPE} MATCHES "^DEBUG")
#append 'd' to debug libraries string(CONCAT postfix ${postfix} "d")
string(CONCAT postfix ${postfix} "d") set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX ${postfix})
set(CMAKE_DEBUG_POSTFIX ${postfix}) else()
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) set_target_properties(kddockwidgets PROPERTIES ${UPPER_BUILD_TYPE}_POSTFIX ${postfix})
endif()
endif() endif()
install(TARGETS kddockwidgets install(TARGETS kddockwidgets
@@ -291,12 +294,16 @@ install(FILES ${DOCKS_INSTALLABLE_PRIVATE_WIDGET_INCLUDES} DESTINATION include/k
install(FILES private/indicators/ClassicIndicators_p.h DESTINATION include/kddockwidgets/private/indicators) install(FILES private/indicators/ClassicIndicators_p.h DESTINATION include/kddockwidgets/private/indicators)
install(FILES private/indicators/SegmentedIndicators_p.h DESTINATION include/kddockwidgets/private/indicators) install(FILES private/indicators/SegmentedIndicators_p.h DESTINATION include/kddockwidgets/private/indicators)
include(CMakePackageConfigHelpers) # Generate library version files
write_basic_package_version_file( include(ECMSetupVersion)
KDDockWidgetsConfigVersion.cmake ecm_setup_version(
VERSION ${${PROJECT_NAME}_VERSION} ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion VARIABLE_PREFIX KDDOCKWIDGETS
) VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgetsConfigVersion.cmake"
SOVERSION ${${PROJECT_NAME}_SOVERSION}
COMPATIBILITY AnyNewerVersion)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h" DESTINATION include/kddockwidgets)
install(EXPORT kddockwidgetsTargets install(EXPORT kddockwidgetsTargets
FILE KDDockWidgetsTargets.cmake FILE KDDockWidgetsTargets.cmake

View File

@@ -23,6 +23,7 @@
#include "private/Position_p.h" #include "private/Position_p.h"
#include "WindowBeingDragged_p.h" #include "WindowBeingDragged_p.h"
#include "SideBar_p.h" #include "SideBar_p.h"
#include "LayoutSaver_p.h"
#include <QEvent> #include <QEvent>
#include <QCloseEvent> #include <QCloseEvent>
@@ -63,6 +64,13 @@ public:
} }
Q_EMIT q->isFloatingChanged(checked); Q_EMIT q->isFloatingChanged(checked);
// When floating, we remove from the sidebar
if (checked && q->isOpen()) {
if (SideBar *sb = DockRegistry::self()->sideBarForDockWidget(q)) {
sb->mainWindow()->clearSideBarOverlay(/* deleteFrame=*/false);
sb->removeDockWidget(q);
}
}
}); });
toggleAction->setCheckable(true); toggleAction->setCheckable(true);

View File

@@ -22,9 +22,10 @@
#include "docks_export.h" #include "docks_export.h"
#include "KDDockWidgets.h" #include "KDDockWidgets.h"
#include "QWidgetAdapter.h" #include "QWidgetAdapter.h"
#include "LayoutSaver_p.h" #include "LayoutSaver.h"
#include <QVector> #include <QVector>
#include <memory>
// clazy:excludeall=ctor-missing-parent-argument // clazy:excludeall=ctor-missing-parent-argument
@@ -173,12 +174,12 @@ public:
* @brief Constructs a dock widget from its serialized form. * @brief Constructs a dock widget from its serialized form.
* @internal * @internal
*/ */
static DockWidgetBase *deserialize(const LayoutSaver::DockWidget::Ptr &); static DockWidgetBase *deserialize(const std::shared_ptr<LayoutSaver::DockWidget> &);
/** /**
* @brief Serializes this dock widget into an intermediate form * @brief Serializes this dock widget into an intermediate form
*/ */
LayoutSaver::DockWidget::Ptr serialize() const; std::shared_ptr<LayoutSaver::DockWidget> serialize() const;
/** /**
* @brief docks @p other widget into this one. Tabs will be shown if not already. * @brief docks @p other widget into this one. Tabs will be shown if not already.
@@ -498,6 +499,9 @@ protected:
void onShown(bool spontaneous); void onShown(bool spontaneous);
void onHidden(bool spontaneous); void onHidden(bool spontaneous);
///@reimp
bool eventFilter(QObject *, QEvent *) override;
#ifndef PYTHON_BINDINGS //Pyside bug: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1327 #ifndef PYTHON_BINDINGS //Pyside bug: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1327
void onCloseEvent(QCloseEvent *e) override; void onCloseEvent(QCloseEvent *e) override;
bool onResize(QSize newSize) override; bool onResize(QSize newSize) override;
@@ -567,9 +571,6 @@ private:
///@brief Updates the floatAction state ///@brief Updates the floatAction state
void updateFloatAction(); void updateFloatAction();
///@reimp
bool eventFilter(QObject *, QEvent *) override;
class Private; class Private;
Private *const d; Private *const d;
}; };

View File

@@ -16,7 +16,7 @@ if (@KDDockWidgets_QTQUICK@)
find_dependency(Qt5Quick REQUIRED) find_dependency(Qt5Quick REQUIRED)
endif() endif()
if (NOT WIN32 AND NOT APPLE) if (NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN)
find_dependency(Qt5X11Extras REQUIRED) find_dependency(Qt5X11Extras REQUIRED)
endif() endif()

View File

@@ -28,6 +28,7 @@
#include "WidgetResizeHandler_p.h" #include "WidgetResizeHandler_p.h"
#include "FrameworkWidgetFactory.h" #include "FrameworkWidgetFactory.h"
#include "DropAreaWithCentralFrame_p.h" #include "DropAreaWithCentralFrame_p.h"
#include "LayoutSaver_p.h"
using namespace KDDockWidgets; using namespace KDDockWidgets;
@@ -485,16 +486,25 @@ void MainWindowBase::toggleOverlayOnSideBar(DockWidgetBase *dw)
} }
} }
void MainWindowBase::clearSideBarOverlay() void MainWindowBase::clearSideBarOverlay(bool deleteFrame)
{ {
if (!d->m_overlayedDockWidget) if (!d->m_overlayedDockWidget)
return; return;
Frame *frame = d->m_overlayedDockWidget->frame(); Frame *frame = d->m_overlayedDockWidget->frame();
d->m_overlayedDockWidget->setParent(nullptr); frame->unoverlay();
Q_EMIT d->m_overlayedDockWidget->isOverlayedChanged(false);
d->m_overlayedDockWidget = nullptr; if (deleteFrame) {
delete frame; d->m_overlayedDockWidget->setParent(nullptr);
Q_EMIT d->m_overlayedDockWidget->isOverlayedChanged(false);
d->m_overlayedDockWidget = nullptr;
delete frame;
} else {
// No cleanup, just unset. When we drag the overlay it becomes a normal floating window
// meaning we reuse Frame. Don't delete it.
Q_EMIT d->m_overlayedDockWidget->isOverlayedChanged(false);
d->m_overlayedDockWidget = nullptr;
}
} }
SideBar *MainWindowBase::sideBarForDockWidget(const DockWidgetBase *dw) const SideBar *MainWindowBase::sideBarForDockWidget(const DockWidgetBase *dw) const

View File

@@ -23,7 +23,7 @@
#include "docks_export.h" #include "docks_export.h"
#include "KDDockWidgets.h" #include "KDDockWidgets.h"
#include "QWidgetAdapter.h" #include "QWidgetAdapter.h"
#include "LayoutSaver_p.h" #include "LayoutSaver.h"
#include <QVector> #include <QVector>
#include <QMargins> #include <QMargins>
@@ -156,7 +156,7 @@ public:
void toggleOverlayOnSideBar(DockWidgetBase *); void toggleOverlayOnSideBar(DockWidgetBase *);
/// @brief closes any overlayed dock widget. The sidebar still displays them as button. /// @brief closes any overlayed dock widget. The sidebar still displays them as button.
void clearSideBarOverlay(); void clearSideBarOverlay(bool deleteFrame = true);
/// @brief Returns the sidebar this dockwidget is in. nullptr if not in any. /// @brief Returns the sidebar this dockwidget is in. nullptr if not in any.
SideBar *sideBarForDockWidget(const DockWidgetBase *) const; SideBar *sideBarForDockWidget(const DockWidgetBase *) const;

View File

@@ -0,0 +1,12 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#include "../../KDDockWidgets.h"

View File

@@ -0,0 +1,12 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#include "../../../private/DragController_p.h"

View File

@@ -636,7 +636,16 @@ bool DockRegistry::eventFilter(QObject *watched, QEvent *event)
auto p = watched; auto p = watched;
while (p) { while (p) {
if (auto dw = qobject_cast<DockWidgetBase*>(p)) if (auto dw = qobject_cast<DockWidgetBase*>(p))
return onDockWidgetPressed(dw, static_cast<QMouseEvent*>(event)); return onDockWidgetPressed(dw, static_cast<QMouseEvent *>(event));
if (auto dropArea = qobject_cast<DropArea *>(p)) {
if (auto mw = dropArea->mainWindow()) {
// The user clicked somewhere in the main window's drop area, but outside of the
// overlayed dock widget
mw->clearSideBarOverlay();
return false;
}
}
p = p->parent(); p = p->parent();
} }

View File

@@ -12,8 +12,8 @@
#ifndef KD_DOCKREGISTRY_P_H #ifndef KD_DOCKREGISTRY_P_H
#define KD_DOCKREGISTRY_P_H #define KD_DOCKREGISTRY_P_H
#include "../DockWidgetBase.h" #include "kddockwidgets/DockWidgetBase.h"
#include "../MainWindowBase.h" #include "kddockwidgets/MainWindowBase.h"
#include <QVector> #include <QVector>
#include <QObject> #include <QObject>

View File

@@ -12,7 +12,7 @@
#ifndef KD_DRAGCONTROLLER_P_H #ifndef KD_DRAGCONTROLLER_P_H
#define KD_DRAGCONTROLLER_P_H #define KD_DRAGCONTROLLER_P_H
#include "docks_export.h" #include "kddockwidgets/docks_export.h"
#include "TitleBar_p.h" #include "TitleBar_p.h"
#include "WindowBeingDragged_p.h" #include "WindowBeingDragged_p.h"

View File

@@ -20,8 +20,8 @@
#define KD_DROP_AREA_P_H #define KD_DROP_AREA_P_H
#include "kddockwidgets/docks_export.h" #include "kddockwidgets/docks_export.h"
#include "kddockwidgets/KDDockWidgets.h"
#include "Frame_p.h" #include "Frame_p.h"
#include "KDDockWidgets.h"
#include "MultiSplitter_p.h" #include "MultiSplitter_p.h"
#include "DropIndicatorOverlayInterface_p.h" #include "DropIndicatorOverlayInterface_p.h"

View File

@@ -12,10 +12,10 @@
#ifndef KD_DROPINDICATOROVERLAYINTERFACE_P_H #ifndef KD_DROPINDICATOROVERLAYINTERFACE_P_H
#define KD_DROPINDICATOROVERLAYINTERFACE_P_H #define KD_DROPINDICATOROVERLAYINTERFACE_P_H
#include "docks_export.h" #include "kddockwidgets/docks_export.h"
#include "QWidgetAdapter.h" #include "kddockwidgets/QWidgetAdapter.h"
#include "kddockwidgets/KDDockWidgets.h"
#include "Frame_p.h" #include "Frame_p.h"
#include "KDDockWidgets.h"
namespace KDDockWidgets { namespace KDDockWidgets {

View File

@@ -20,6 +20,7 @@
#include "DockRegistry_p.h" #include "DockRegistry_p.h"
#include "Config.h" #include "Config.h"
#include "FrameworkWidgetFactory.h" #include "FrameworkWidgetFactory.h"
#include "../LayoutSaver_p.h"
#include <QCloseEvent> #include <QCloseEvent>
#include <QAbstractNativeEventFilter> #include <QAbstractNativeEventFilter>

View File

@@ -12,13 +12,13 @@
#ifndef KD_FLOATING_WINDOW_P_H #ifndef KD_FLOATING_WINDOW_P_H
#define KD_FLOATING_WINDOW_P_H #define KD_FLOATING_WINDOW_P_H
#include "../docks_export.h" #include "kddockwidgets/docks_export.h"
#include "../QWidgetAdapter.h" #include "kddockwidgets/QWidgetAdapter.h"
#include "../LayoutSaver_p.h" #include "kddockwidgets/LayoutSaver.h"
#include "kddockwidgets/Qt5Qt6Compat_p.h"
#include "Frame_p.h" #include "Frame_p.h"
#include "Draggable_p.h" #include "Draggable_p.h"
#include "DropArea_p.h" #include "DropArea_p.h"
#include "Qt5Qt6Compat_p.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractNativeEventFilter; class QAbstractNativeEventFilter;

View File

@@ -26,6 +26,7 @@
#include "Config.h" #include "Config.h"
#include "TitleBar_p.h" #include "TitleBar_p.h"
#include "FrameworkWidgetFactory.h" #include "FrameworkWidgetFactory.h"
#include "kddockwidgets/LayoutSaver.h"
#include <QCloseEvent> #include <QCloseEvent>
#include <QTimer> #include <QTimer>
@@ -576,6 +577,11 @@ bool Frame::isOverlayed() const
return m_options & FrameOption_IsOverlayed; return m_options & FrameOption_IsOverlayed;
} }
void Frame::unoverlay()
{
m_options &= ~FrameOption_IsOverlayed;
}
bool Frame::isFloating() const bool Frame::isFloating() const
{ {
if (isInMainWindow()) if (isInMainWindow())

View File

@@ -22,7 +22,7 @@
#include "kddockwidgets/docks_export.h" #include "kddockwidgets/docks_export.h"
#include "kddockwidgets/QWidgetAdapter.h" #include "kddockwidgets/QWidgetAdapter.h"
#include "kddockwidgets/FocusScope.h" #include "kddockwidgets/FocusScope.h"
#include "../LayoutSaver_p.h" #include "kddockwidgets/LayoutSaver.h"
#include "multisplitter/Widget.h" #include "multisplitter/Widget.h"
#include "multisplitter/Item_p.h" #include "multisplitter/Item_p.h"
@@ -127,6 +127,10 @@ public:
///@brief Returns whether this frame is overlayed on top of the MainWindow (auto-hide feature); ///@brief Returns whether this frame is overlayed on top of the MainWindow (auto-hide feature);
bool isOverlayed() const; bool isOverlayed() const;
///@brief clears the FrameOption_IsOverlayed flag.
/// For example, if you drag a side-bar overlay, then it becomes a normal floating window
void unoverlay();
/** /**
* @brief Returns whether this frame is floating. A floating frame isn't attached to any other MainWindow, * @brief Returns whether this frame is floating. A floating frame isn't attached to any other MainWindow,
* and if it's attached to a FloatingWindow then it's considered floating if it's the only frame in that Window. * and if it's attached to a FloatingWindow then it's considered floating if it's the only frame in that Window.
@@ -295,7 +299,7 @@ private:
bool event(QEvent *) override; bool event(QEvent *) override;
TitleBar *const m_titleBar; TitleBar *const m_titleBar;
DropArea *m_dropArea = nullptr; DropArea *m_dropArea = nullptr;
const FrameOptions m_options; FrameOptions m_options = FrameOption_None;
QPointer<Layouting::Item> m_layoutItem; QPointer<Layouting::Item> m_layoutItem;
bool m_updatingTitleBar = false; bool m_updatingTitleBar = false;
bool m_beingDeleted = false; bool m_beingDeleted = false;

View File

@@ -28,6 +28,7 @@
#include "Position_p.h" #include "Position_p.h"
#include "DockRegistry_p.h" #include "DockRegistry_p.h"
#include "Config.h" #include "Config.h"
#include "../LayoutSaver_p.h"
#include "FrameworkWidgetFactory.h" #include "FrameworkWidgetFactory.h"
#include "multisplitter/Widget.h" #include "multisplitter/Widget.h"
#include "DropArea_p.h" #include "DropArea_p.h"

View File

@@ -22,12 +22,11 @@
#ifndef KDDOCKWIDGETS_MULTISPLITTER_P_H #ifndef KDDOCKWIDGETS_MULTISPLITTER_P_H
#define KDDOCKWIDGETS_MULTISPLITTER_P_H #define KDDOCKWIDGETS_MULTISPLITTER_P_H
#include "docks_export.h" #include "kddockwidgets/docks_export.h"
#include "kddockwidgets/QWidgetAdapter.h"
#include "kddockwidgets/KDDockWidgets.h"
#include "kddockwidgets/LayoutSaver.h"
#include "multisplitter/Separator_p.h" #include "multisplitter/Separator_p.h"
#include "QWidgetAdapter.h"
#include "KDDockWidgets.h"
#include "LayoutSaver_p.h"
namespace Layouting { namespace Layouting {
class Item; class Item;

View File

@@ -18,7 +18,8 @@
#ifndef KDDOCKWIDGETS_POSITION_P_H #ifndef KDDOCKWIDGETS_POSITION_P_H
#define KDDOCKWIDGETS_POSITION_P_H #define KDDOCKWIDGETS_POSITION_P_H
#include "docks_export.h" #include "kddockwidgets/docks_export.h"
#include "Logging_p.h" #include "Logging_p.h"
#include "LayoutSaver_p.h" #include "LayoutSaver_p.h"
#include "multisplitter/Item_p.h" #include "multisplitter/Item_p.h"

View File

@@ -12,7 +12,8 @@
#ifndef KD_SIDEBAR_P_H #ifndef KD_SIDEBAR_P_H
#define KD_SIDEBAR_P_H #define KD_SIDEBAR_P_H
#include "docks_export.h" #include "kddockwidgets/docks_export.h"
#include "KDDockWidgets.h" #include "KDDockWidgets.h"
#include "QWidgetAdapter.h" #include "QWidgetAdapter.h"

View File

@@ -12,7 +12,7 @@
#ifndef KD_WINDOWBEINGDRAGGED_P_H #ifndef KD_WINDOWBEINGDRAGGED_P_H
#define KD_WINDOWBEINGDRAGGED_P_H #define KD_WINDOWBEINGDRAGGED_P_H
#include "docks_export.h" #include "kddockwidgets/docks_export.h"
#include "FloatingWindow_p.h" #include "FloatingWindow_p.h"
#include <QPointer> #include <QPointer>

View File

@@ -12,7 +12,7 @@
#ifndef KD_MAIN_WINDOW_WRAPPER_P_H #ifndef KD_MAIN_WINDOW_WRAPPER_P_H
#define KD_MAIN_WINDOW_WRAPPER_P_H #define KD_MAIN_WINDOW_WRAPPER_P_H
#include "docks_export.h" #include "kddockwidgets/docks_export.h"
#include "QWidgetAdapter.h" #include "QWidgetAdapter.h"
#include <QQuickItem> #include <QQuickItem>

View File

@@ -21,7 +21,7 @@
#ifndef KDDOCKWIDGETS_QWIDGETADAPTERQUICK_P_H #ifndef KDDOCKWIDGETS_QWIDGETADAPTERQUICK_P_H
#define KDDOCKWIDGETS_QWIDGETADAPTERQUICK_P_H #define KDDOCKWIDGETS_QWIDGETADAPTERQUICK_P_H
#include "../../docks_export.h" #include "kddockwidgets/docks_export.h"
#include "kddockwidgets/Qt5Qt6Compat_p.h" #include "kddockwidgets/Qt5Qt6Compat_p.h"
#include <QQuickItem> #include <QQuickItem>

View File

@@ -12,8 +12,8 @@
#ifndef KD_TITLEBARQUICK_P_H #ifndef KD_TITLEBARQUICK_P_H
#define KD_TITLEBARQUICK_P_H #define KD_TITLEBARQUICK_P_H
#include "../docks_export.h" #include "kddockwidgets/docks_export.h"
#include "../TitleBar_p.h" #include "kddockwidgets/TitleBar_p.h"
namespace KDDockWidgets { namespace KDDockWidgets {

View File

@@ -21,7 +21,7 @@
#ifndef KDDOCKWIDGETS_QWIDGETADAPTERWIDGETS_P_H #ifndef KDDOCKWIDGETS_QWIDGETADAPTERWIDGETS_P_H
#define KDDOCKWIDGETS_QWIDGETADAPTERWIDGETS_P_H #define KDDOCKWIDGETS_QWIDGETADAPTERWIDGETS_P_H
#include "../../docks_export.h" #include "kddockwidgets/docks_export.h"
#include <QWindow> #include <QWindow>
#include <QWidget> #include <QWidget>

View File

@@ -12,7 +12,7 @@
#ifndef KD_SIDEBARWIDGET_P_H #ifndef KD_SIDEBARWIDGET_P_H
#define KD_SIDEBARWIDGET_P_H #define KD_SIDEBARWIDGET_P_H
#include "../../docks_export.h" #include "kddockwidgets/docks_export.h"
#include "../SideBar_p.h" #include "../SideBar_p.h"
#include <QToolButton> #include <QToolButton>

View File

@@ -20,10 +20,11 @@
#ifndef KD_TAB_WIDGET_P_H #ifndef KD_TAB_WIDGET_P_H
#define KD_TAB_WIDGET_P_H #define KD_TAB_WIDGET_P_H
#include "../docks_export.h" #include "kddockwidgets/docks_export.h"
#include "kddockwidgets/DockWidgetBase.h"
#include "../Draggable_p.h" #include "../Draggable_p.h"
#include "../Frame_p.h" #include "../Frame_p.h"
#include "../DockWidgetBase.h"
#include <QTabBar> #include <QTabBar>
#include <QVector> #include <QVector>

View File

@@ -12,8 +12,8 @@
#ifndef KD_TITLEBARWIDGET_P_H #ifndef KD_TITLEBARWIDGET_P_H
#define KD_TITLEBARWIDGET_P_H #define KD_TITLEBARWIDGET_P_H
#include "../../docks_export.h" #include "kddockwidgets/docks_export.h"
#include "../TitleBar_p.h" #include "kddockwidgets/private/TitleBar_p.h"
#include <QPainter> #include <QPainter>
#include <QToolButton> #include <QToolButton>

View File

@@ -252,6 +252,8 @@ private Q_SLOTS:
void tst_negativeAnchorPositionWhenEmbedded_data(); void tst_negativeAnchorPositionWhenEmbedded_data();
void tst_closeRemovesFromSideBar(); void tst_closeRemovesFromSideBar();
void tst_restoreSideBar(); void tst_restoreSideBar();
void tst_sidebarOverlayGetsHiddenOnClick();
void tst_floatRemovesFromSideBar();
// And fix these // And fix these
void tst_floatingWindowDeleted(); void tst_floatingWindowDeleted();
@@ -5213,6 +5215,93 @@ void TestDocks::tst_restoreSideBar()
delete fw1; delete fw1;
} }
void TestDocks::tst_sidebarOverlayGetsHiddenOnClick()
{
EnsureTopLevelsDeleted e;
KDDockWidgets::Config::self().setFlags(KDDockWidgets::Config::Flag_AutoHideSupport);
{
// Case #1 click on another dockwidget should hide the overlay
auto m1 = createMainWindow(QSize(1000, 1000), MainWindowOption_None, "MW1");
auto dw1 = new DockWidgetType(QStringLiteral("1"));
auto dw2 = new DockWidgetType(QStringLiteral("2"));
m1->addDockWidget(dw1, Location_OnBottom);
m1->addDockWidget(dw2, Location_OnBottom);
m1->moveToSideBar(dw1);
m1->overlayOnSideBar(dw1);
QVERIFY(dw1->isOverlayed());
Tests::clickOn(dw2->mapToGlobal(dw2->rect().bottomLeft() + QPoint(5, -5)), dw2);
QVERIFY(!dw1->isOverlayed());
auto widget2 = new MyWidget("foo");
dw2->setWidget(widget2);
m1->overlayOnSideBar(dw1);
QVERIFY(dw1->isOverlayed());
Tests::clickOn(widget2->mapToGlobal(widget2->rect().bottomLeft() + QPoint(5, -5)), widget2);
QVERIFY(!dw1->isOverlayed());
delete dw1;
}
{
// Case #1 click on empty main window space, should hide the overlay
auto m1 = createMainWindow(QSize(1000, 1000), MainWindowOption_None, "MW1");
auto dw1 = new DockWidgetType(QStringLiteral("1"));
m1->addDockWidget(dw1, Location_OnBottom);
m1->moveToSideBar(dw1);
m1->overlayOnSideBar(dw1);
QVERIFY(dw1->isOverlayed());
const QPoint localPt(100, 250);
Tests::clickOn(m1->mapToGlobal(m1->rect().topLeft() + localPt), m1->childAt(localPt));
QVERIFY(!dw1->isOverlayed());
delete dw1;
}
}
void TestDocks::tst_floatRemovesFromSideBar()
{
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);
m1->moveToSideBar(dw1);
m1->overlayOnSideBar(dw1);
QVERIFY(dw1->isOverlayed());
QVERIFY(!dw1->isFloating());
QVERIFY(dw1->isInMainWindow());
dw1->setFloating(true);
QVERIFY(!dw1->isOverlayed());
QVERIFY(dw1->isFloating());
QVERIFY(!dw1->isInMainWindow());
QCOMPARE(dw1->sideBarLocation(), SideBarLocation::None);
// Also test a crash I got
m1->addDockWidget(dw1, Location_OnBottom);
auto tb = dw1->titleBar();
QVERIFY(tb->isVisible());
tb->onFloatClicked();
}
void TestDocks::tst_embeddedMainWindow() void TestDocks::tst_embeddedMainWindow()
{ {
EnsureTopLevelsDeleted e; EnsureTopLevelsDeleted e;