Compare commits

..

29 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
038f4fdb44 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0)
- [github.com/pre-commit/mirrors-clang-format: v14.0.6 → v15.0.7](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.6...v15.0.7)
- [github.com/PyCQA/pylint: v2.15.5 → v2.16.1](https://github.com/PyCQA/pylint/compare/v2.15.5...v2.16.1)
- [github.com/pre-commit/mirrors-autopep8: v1.7.0 → v2.0.1](https://github.com/pre-commit/mirrors-autopep8/compare/v1.7.0...v2.0.1)
- [github.com/fsfe/reuse-tool: v1.0.0 → v1.1.0](https://github.com/fsfe/reuse-tool/compare/v1.0.0...v1.1.0)
2023-02-07 02:41:47 +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
805 changed files with 25110 additions and 143304 deletions

View File

@@ -47,7 +47,7 @@ AlignAfterOpenBracket: true
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackParameters: true
ColumnLimit: 100
ColumnLimit: 0
Cpp11BracedListStyle: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false

View File

@@ -49,7 +49,7 @@ with section("format"):
# If a positional argument group contains more than this many arguments, then
# force it to a vertical layout.
max_pargs_hwrap = 6
max_pargs_hwrap = 4
# If a cmdline positional group consumes more than this many lines without
# nesting, then invalidate the layout (and nest)
@@ -94,7 +94,8 @@ with section("format"):
keyword_case = 'upper'
# A list of command names which should always be wrapped
always_wrap = []
always_wrap = ["add_executable", "add_library",
"target_link_libraries", "target_include_directories", "install"]
# If true, the argument lists which are known to be sortable will be sorted
# lexicographicall
@@ -102,7 +103,7 @@ with section("format"):
# If true, the parsers may infer whether or not an argument list is sortable
# (without annotation).
autosort = False
autosort = True
# By default, if cmake-format cannot successfully fit everything into the
# desired linewidth it will apply the last, most agressive attempt that it

View File

@@ -1,4 +1,4 @@
[codespell]
skip = ./build-*,.git,*.svg,rc_assets.py,./src/flutter/generated*
skip = ./build-*,.git,*.svg,rc_assets.py
interactive = 3
ignore-words-list = overlay,overlayed,seh,sharable
ignore-words-list = overlay,overlayed

7
.gitignore vendored
View File

@@ -67,10 +67,3 @@ kddockwidgets_minimal_example
.vscode
/.cache
/compile_commands.json
/site
.DS_Store
.packages
pubspec.lock
.dart_tool
mjb_rejected_*
mjb_rejected_classes.log

3
.krazy
View File

@@ -16,6 +16,9 @@ EXCLUDE style
SKIP /fwd_headers/
SKIP Doxyfile.cmake
#skip some example files
SKIP /examples/qtquick/CMakeFiles/
#skip CMake files
SKIP /KDDockWidgetsConfig.cmake.in
#skip more files

View File

@@ -1,4 +1,5 @@
all
rule 'MD007', :indent => 2, :start_indented => false
rule 'MD013', :line_length => 100, :tables => false
rule 'MD029', :style => :ordered
exclude_rule 'MD033'

View File

@@ -1,9 +1,9 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: ^(cmake/ECM|cmake/KDAB/|src/3rdparty/)
exclude: ^(cmake/ECM|cmake/KDAB/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@@ -13,22 +13,22 @@ repos:
args: [--allow-multiple-documents]
- id: check-json
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v15.0.7
hooks:
- id: clang-format
exclude: (.json)
- repo: https://github.com/PyCQA/pylint
rev: v2.15.3
rev: v2.16.1
hooks:
- id: pylint
exclude: ^(.cmake-format.py|conan/conanfile.py)
additional_dependencies: ["PySide2", "PySide6"]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
rev: v2.0.1
hooks:
- id: autopep8
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.2
hooks:
- id: codespell
- repo: https://github.com/cheshirekow/cmake-format-precommit
@@ -39,13 +39,13 @@ repos:
- id: cmake-format
exclude: (.py.cmake|Doxyfile.cmake)
- repo: https://github.com/markdownlint/markdownlint
rev: v0.11.0
rev: v0.12.0
hooks:
- id: markdownlint
entry: mdl
language: ruby
files: \.(md|mdown|markdown)$
- repo: https://github.com/fsfe/reuse-tool
rev: v1.0.0
rev: v1.1.0
hooks:
- id: reuse

View File

@@ -140,6 +140,8 @@ disable=print-statement,
exception-escape,
comprehension-escape,
consider-using-f-string,
useless-option-value,
unknown-option-value,
R0801,I1101,E0401
# Enable the message, report, category or checker with the given id(s). You can

View File

@@ -5,34 +5,25 @@ Source: https://www.github.com/KDAB/KDDockWidgets
#misc source code
Files: *.qrc *.json *.xml src/fwd_headers/*
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Copyright: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: GPL-2.0-only OR GPL-3.0-only
#misc documentation
Files: CONTRIBUTORS.txt Changelog README.md README-QtQuick.md README-WASM.md README-Wayland.md README-bindings.md README-troubleshooting conan/README.txt python/examples/README.txt python/examples-qt6/README.txt docs_devel/*.md docs/KDDockWidgets-CopyrightAssignmentForm.pdf *.html
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Files: CONTRIBUTORS.txt Changelog README.md README-QtQuick.md README-WASM.md README-Wayland.md README-bindings.md README-troubleshooting conan/README.txt python/examples/README.txt python/examples-qt6/README.txt docs/KDDockWidgets-CopyrightAssignmentForm.pdf *.html
Copyright: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: GPL-2.0-only OR GPL-3.0-only
#misc config files
Files: .pre-commit-config.yaml .codespellrc .krazy .cmake-format .clang-format .clazy .gitignore .mdlrc .mdlrc.rb .pep8 .pylintrc appveyor.yml mkdocs.yml code.dev-*.code-workspace code.dev*.code-workspace docs/api/Doxyfile.cmake distro/* *.yaml
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Files: .pre-commit-config.yaml .codespellrc .krazy .cmake-format .clang-format .clazy .gitignore .mdlrc .mdlrc.rb .pep8 .pylintrc appveyor.yml code.dev-*.code-workspace docs/api/Doxyfile.cmake distro/*
Copyright: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: BSD-3-Clause
#artwork
Files: screencap.gif images/* src/img/* docs/api/*.png examples/dockwidgets/assets/*.png src/img/classic_indicators/*.png
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Copyright: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
License: GPL-2.0-only OR GPL-3.0-only
#3rdparty
Files: cmake/ECM/modules/*
Copyright: The KDE Project
License: BSD-3-Clause
#3rdparty C++
Files: src/3rdparty/kdbindings/genindex_array.h
Copyright: 2021 Jeremy Burns
License: MIT
Files: src/3rdparty/doctest/doctest.h
Copyright: 2016-2021 Viktor Kirilov <vik.kirilov@gmail.com>
License: MIT

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -11,48 +11,63 @@
# Pass the following variables to cmake to control the build:
#
# -DKDDockWidgets_QT6=[true|false] Build against Qt6 rather than Qt5
# Default=false (Qt5 will be used even if Qt6 is available)
# -DKDDockWidgets_QT6=[true|false]
# Build against Qt6 rather than Qt5
# Default=false (Qt5 will be used even if Qt6 is available)
#
# -DKDDockWidgets_STATIC=[true|false] Build static versions of the libraries
# Default=false
# -DKDDockWidgets_STATIC=[true|false]
# Build static versions of the libraries
# Default=false
#
# -DKDDockWidgets_TESTS=[true|false] Build the test harness. Currently ignored
# (except for Python bindings) unless KDDockWidgets_DEVELOPER_MODE=True.
# Default=false
# -DKDDockWidgets_TESTS=[true|false]
# Build the test harness.
# Currently ignored (except for Python bindings) unless KDDockWidgets_DEVELOPER_MODE=True.
# Default=false
#
# -DKDDockWidgets_EXAMPLES=[true|false] Build the examples. Default=true
# -DKDDockWidgets_EXAMPLES=[true|false]
# Build the examples.
# Default=true
#
# -DKDDockWidgets_DOCS=[true|false] Build the API documentation. Enables the
# 'docs' build target. Default=false
# -DKDDockWidgets_DOCS=[true|false]
# Build the API documentation. Enables the 'docs' build target.
# Default=false
#
# -DKDDockWidgets_PYTHON_BINDINGS=[true|false] Build/Generate python bindings.
# Always false for Debug builds (If your shiboken or pyside is installed in a
# non-standard locations try passing the SHIBOKEN_CUSTOM_PREFIX and
# PYSIDE_CUSTOM_PREFIX variables.) Default=false
# -DKDDockWidgets_QTQUICK=[true|false]
# Build for QtQuick instead of QtWidgets.
# Default=false
#
# -DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=[path] Set an alternative
# install path for Python bindings Default=CMAKE_INSTALL_PREFIX
# -DKDDockWidgets_PYTHON_BINDINGS=[true|false]
# Build/Generate python bindings. Always false for Debug builds
# (If your shiboken or pyside is installed in a non-standard locations
# try passing the SHIBOKEN_CUSTOM_PREFIX and PYSIDE_CUSTOM_PREFIX variables.)
# Default=false
#
# -DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=[path]
# Set an alternative install path for Python bindings
# Default=CMAKE_INSTALL_PREFIX
# ## DO NOT USE IF YOU ARE AN END-USER. FOR THE DEVELOPERS ONLY!! # Special
# CMake Options for Developers
# ## DO NOT USE IF YOU ARE AN END-USER. FOR THE DEVELOPERS ONLY!!
## Special CMake Options for Developers
#
# -DKDDockWidgets_DEVELOPER_MODE=[true|false] Configure the build for a
# developer setup. Enables some features that are not geared towards end-users.
# Forces the test harness to be built. Default=false
# -DKDDockWidgets_DEVELOPER_MODE=[true|false]
# Configure the build for a developer setup.
# Enables some features that are not geared towards end-users.
# Forces the test harness to be built.
# Default=false
#
# -DKDDockWidgets_WERROR=[true|false] Compile with the -Werror gcc/clang option
# (always true for developer-mode) Default=false
# -DKDDockWidgets_WERROR=[true|false]
# Compile with the -Werror gcc/clang option (always true for developer-mode)
# Default=false
#
# -DKDDockWidgets_LINTER=[true|false] Build the layout linter. Ignored unless
# KDDockWidgets_DEVELOPER_MODE=True Default=true
# -DKDDockWidgets_LINTER=[true|false]
# Build the layout linter.
# Ignored unless KDDockWidgets_DEVELOPER_MODE=True
# Default=true
#
# -DKDDockWidgets_CODE_COVERAGE=[true|false] Enable coverage reporting. Ignored
# unless KDDockWidgets_DEVELOPER_MODE=True Default=false
#
# -DKDDockWidgets_FRONTENDS='qtwidgets;qtquick' Semicolon separated list of
# frontends to enable. If not specified, frontends will be enabled based on
# availability of libraries on your system.
# -DKDDockWidgets_FUZZER=[true|false]
# Build the fuzzer.
# Ignored unless KDDockWidgets_DEVELOPER_MODE=True
# Default=true
cmake_minimum_required(VERSION 3.12)
@@ -61,7 +76,6 @@ set(KDAB_INSTALL
True
CACHE INTERNAL "Install to default KDAB Location"
)
if(DEFINED CMAKE_INSTALL_PREFIX)
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(KDAB_INSTALL
@@ -78,170 +92,96 @@ project(
LANGUAGES CXX
)
set(KDDockWidgets_VERSION_MAJOR 2)
set(KDDockWidgets_VERSION_MINOR 0)
set(KDDockWidgets_VERSION_PATCH 9)
set(KDDockWidgets_VERSION ${KDDockWidgets_VERSION_MAJOR}.${KDDockWidgets_VERSION_MINOR}.${KDDockWidgets_VERSION_PATCH})
set(PROJECT_VERSION ${KDDockWidgets_VERSION}) # PROJECT_VERSION is needed by some ECM modules
set(KDDockWidgets_SOVERSION "2.0")
set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 6)
set(${PROJECT_NAME}_VERSION_PATCH 95)
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.7")
include(FeatureSummary)
option(KDDockWidgets_QT6 "Build against Qt 6" OFF)
option(KDDockWidgets_DEVELOPER_MODE "Developer Mode" OFF)
option(KDDockWidgets_PYTHON_BINDINGS "Build python bindings" OFF)
option(KDDockWidgets_STATIC "Build statically" OFF)
option(KDDockWidgets_TESTS "Build the tests" OFF)
option(KDDockWidgets_EXAMPLES "Build the examples" ON)
option(KDDockWidgets_DOCS "Build the API documentation" OFF)
option(KDDockWidgets_WERROR "Use -Werror (will be true for developer-mode unconditionally)" OFF)
option(KDDockWidgets_X11EXTRAS
"Link against QtX11Extras to detect if the compositor supports transparency. Not applicable on non-Linux or Qt6."
option(${PROJECT_NAME}_QT6 "Build against Qt 6" OFF)
option(${PROJECT_NAME}_DEVELOPER_MODE "Developer Mode" OFF)
option(${PROJECT_NAME}_PYTHON_BINDINGS "Build python bindings" OFF)
option(${PROJECT_NAME}_QTQUICK "Build for QtQuick instead of QtWidgets" OFF)
option(${PROJECT_NAME}_STATIC "Build statically" OFF)
option(${PROJECT_NAME}_TESTS "Build the tests" OFF)
option(${PROJECT_NAME}_EXAMPLES "Build the examples" ON)
option(${PROJECT_NAME}_DOCS "Build the API documentation" OFF)
option(${PROJECT_NAME}_WERROR "Use -Werror (will be true for developer-mode unconditionally)" OFF)
option(${PROJECT_NAME}_X11EXTRAS
"Link with QtX11Extras to detect if the compositor supports transparency. Not applicable to non-Linux or Qt6."
ON
)
option(KDDockWidgets_XLib "On Linux, link against XLib, for a more robust window z-order detection." OFF)
option(KDDockWidgets_CODE_COVERAGE "Enable coverage reporting" OFF)
option(KDDockWidgets_FRONTENDS "Semicolon separated list of frontends to enable" "")
option(${PROJECT_NAME}_XLib "On Linux, link against XLib, for a more robust window z-order detection." OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ECM/modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/KDAB/modules")
# Set a default build type if none was specified
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" OR KDDockWidgets_DEVELOPER_MODE)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" OR ${PROJECT_NAME}_DEVELOPER_MODE)
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to ${default_build_type} as none was specified.")
set(CMAKE_BUILD_TYPE
"${default_build_type}"
CACHE STRING "Choose the type of build." FORCE
)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug"
"Release"
"MinSizeRel"
"RelWithDebInfo"
)
endif()
if(KDDockWidgets_XLib)
if(${PROJECT_NAME}_XLib)
add_definitions(-DKDDockWidgets_XLIB)
endif()
if(MSVC AND MSVC_TOOLSET_VERSION LESS 142)
message(FATAL_ERROR "VS 2019 is the minimum required toolset")
endif()
if(KDDockWidgets_QT6)
if(${PROJECT_NAME}_QT6)
set(Qt_VERSION_MAJOR 6)
set(QT_MIN_VERSION "6.2.0")
set(KDDockWidgets_LIBRARY_QTID "-qt6")
set(${PROJECT_NAME}_LIBRARY_QTID "-qt6")
else()
set(Qt_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.15")
set(KDDockWidgets_LIBRARY_QTID "")
set(${PROJECT_NAME}_LIBRARY_QTID "")
endif()
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Widgets Test)
include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables
# BEGIN frontend enabling
if(KDDockWidgets_FRONTENDS)
set(KDDockWidgets_ALL_FRONTENDS "qtwidgets;qtquick;dummy;flutter")
foreach(frontend ${KDDockWidgets_FRONTENDS})
if(NOT ${frontend} IN_LIST KDDockWidgets_ALL_FRONTENDS)
message(FATAL_ERROR "Unknown frontend ${frontend}")
endif()
endforeach()
endif()
if(KDDockWidgets_FRONTENDS)
# qtwidgets
if("qtwidgets" IN_LIST KDDockWidgets_FRONTENDS)
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Widgets)
set(KDDW_FRONTEND_QTWIDGETS ON)
endif()
# qtquick
if("qtquick" IN_LIST KDDockWidgets_FRONTENDS)
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Quick QuickControls2)
set(KDDW_FRONTEND_QTQUICK ON)
endif()
# dummy
if("dummy" IN_LIST KDDockWidgets_FRONTENDS)
# For now dummy still depends on Qt
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Gui)
set(KDDW_FRONTEND_DUMMY ON)
endif()
# flutter
if("flutter" IN_LIST KDDockWidgets_FRONTENDS)
# For now flutter still depends on Qt
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Gui)
set(KDDW_FRONTEND_FLUTTER ON)
endif()
set(${PROJECT_NAME}_DEPS "widgets")
if(${PROJECT_NAME}_QTQUICK)
find_package(Qt${Qt_VERSION_MAJOR} NO_MODULE REQUIRED COMPONENTS Quick QuickControls2)
add_definitions(-DKDDOCKWIDGETS_QTQUICK)
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} quick quickcontrols2")
else()
set(ENABLED_FRONTENDS "")
message("No frontends specified explicitly.")
# qtwidgets
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE COMPONENTS Widgets Quick QuickControls2)
if(Qt${Qt_VERSION_MAJOR}Widgets_FOUND)
list(APPEND ENABLED_FRONTENDS "qtwidgets")
set(KDDW_FRONTEND_QTWIDGETS ON)
endif()
# qtquick
if(Qt${Qt_VERSION_MAJOR}Quick_FOUND AND Qt${Qt_VERSION_MAJOR}QuickControls2_FOUND)
list(APPEND ENABLED_FRONTENDS "qtquick")
set(KDDW_FRONTEND_QTQUICK ON)
endif()
if(NOT ENABLED_FRONTENDS)
message(FATAL_ERROR "Failed to enable any frontends. Please install the required libraries and try again.")
endif()
message("Following frontends have been enabled:")
foreach(frontend ${ENABLED_FRONTENDS})
message("* ${frontend}")
endforeach()
endif()
# END frontend enabling
include(KDQtInstallPaths) # to set QT_INSTALL_FOO variables
add_definitions(-DQT_NO_KEYWORDS)
option(KDockWidgets_PRETTY_QTWIDGETS_HEADERS
"Install DockWidget.h and MainWindow.h as synonyms to the *_qtwidgets.h counterparts."
${KDDW_FRONTEND_QTWIDGETS}
)
if(KDDW_FRONTEND_QTWIDGETS)
set(KDDockWidgets_DEPS "widgets")
endif()
if(KDDW_FRONTEND_QTQUICK)
set(KDDockWidgets_DEPS "${KDDockWidgets_DEPS} quick quickcontrols2")
add_definitions(-DKDDOCKWIDGETS_QTWIDGETS)
endif()
if(NOT WIN32
AND NOT APPLE
AND NOT EMSCRIPTEN
AND NOT KDDockWidgets_QT6
AND KDDockWidgets_X11EXTRAS
AND NOT ${PROJECT_NAME}_QT6
AND ${PROJECT_NAME}_X11EXTRAS
)
set(KDDockWidgets_DEPS "${KDDockWidgets_DEPS} x11extras")
set(${PROJECT_NAME}_DEPS "${${PROJECT_NAME}_DEPS} x11extras")
endif()
# Always build the test harness in developer-mode
if(KDDockWidgets_DEVELOPER_MODE)
set(KDDockWidgets_TESTS ON)
set(KDDockWidgets_WERROR ON)
#Always build the test harness in developer-mode
if(${PROJECT_NAME}_DEVELOPER_MODE)
set(${PROJECT_NAME}_TESTS ON)
set(${PROJECT_NAME}_WERROR ON)
include(ECMEnableSanitizers)
# find_package(doctest REQUIRED) TODOm3
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@@ -250,8 +190,10 @@ else()
set(IS_CLANG_BUILD FALSE)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(${PROJECT_NAME}_QTQUICK)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
@@ -263,7 +205,7 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# Sets compiler flags for the specified target, taking platform into consideration.
macro(set_compiler_flags targetName)
if(KDDockWidgets_DEVELOPER_MODE)
if(${PROJECT_NAME}_DEVELOPER_MODE)
target_compile_definitions(
${targetName}
PUBLIC DOCKS_DEVELOPER_MODE
@@ -280,7 +222,7 @@ macro(set_compiler_flags targetName)
endif()
# Enable -Werror
if(KDDockWidgets_WERROR AND (NOT MSVC OR IS_CLANG_BUILD)) # clang-cl accepts these too
if(${PROJECT_NAME}_WERROR AND (NOT MSVC OR IS_CLANG_BUILD)) # clang-cl accepts these too
target_compile_options(${targetName} PRIVATE -Werror -Wundef -Wno-error=deprecated-declarations)
endif()
endmacro()
@@ -294,7 +236,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE)
else()
@@ -311,21 +252,21 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
endif()
endif()
if(KDDockWidgets_STATIC)
set(KDDockWidgets_LIBRARY_MODE "STATIC")
if(${PROJECT_NAME}_STATIC)
set(${PROJECT_NAME}_LIBRARY_MODE "STATIC")
else()
set(KDDockWidgets_LIBRARY_MODE "SHARED")
set(${PROJECT_NAME}_LIBRARY_MODE "SHARED")
endif()
if(KDAB_INSTALL)
if(UNIX)
set(CMAKE_INSTALL_PREFIX
"/usr/local/KDAB/KDDockWidgets-${KDDockWidgets_VERSION}"
"/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}"
CACHE INTERNAL "Install to default KDAB Location"
)
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX
"C:\\KDAB\\KDDockWidgets-${KDDockWidgets_VERSION}"
"C:\\KDAB\\${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}"
CACHE INTERNAL "Install to default KDAB Location"
)
endif()
@@ -335,9 +276,9 @@ endif()
include(KDInstallLocation)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(KDDockWidgets_IS_ROOT_PROJECT TRUE)
set(${PROJECT_NAME}_IS_ROOT_PROJECT TRUE)
message(STATUS "Building KDDockWidgets ${KDDockWidgets_VERSION} in ${CMAKE_BUILD_TYPE} mode. "
message(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} in ${CMAKE_BUILD_TYPE} mode. "
"Installing to ${CMAKE_INSTALL_PREFIX}"
)
@@ -348,18 +289,18 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
# Generate .pri file for qmake users
# Generate .pri file for qmake users (except when using the VS generator)
if(NOT CMAKE_CONFIGURATION_TYPES)
if(Qt_VERSION_MAJOR EQUAL 5 OR (Qt_VERSION_MAJOR EQUAL 6 AND Qt6Core_VERSION VERSION_GREATER "6.2"))
include(ECMGeneratePriFile)
set(PROJECT_VERSION_STRING ${KDDockWidgets_VERSION})
set(PROJECT_VERSION_STRING ${${PROJECT_NAME}_VERSION})
ecm_generate_pri_file(
BASE_NAME
KDDockWidgets
LIB_NAME
kddockwidgets${${PROJECT_NAME}_LIBRARY_QTID}
DEPS
${KDDockWidgets_DEPS}
${${PROJECT_NAME}_DEPS}
FILENAME_VAR
pri_filename
INCLUDE_INSTALL_DIR
@@ -369,67 +310,50 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
endif()
endif()
else()
# Always disable tests, examples, docs when used as a submodule
set(KDDockWidgets_IS_ROOT_PROJECT FALSE)
set(KDDockWidgets_TESTS FALSE)
set(KDDockWidgets_EXAMPLES FALSE)
set(KDDockWidgets_DOCS FALSE)
#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(KDDockWidgets_TESTS)
if(${PROJECT_NAME}_TESTS)
enable_testing()
endif()
add_subdirectory(src)
if(KDDockWidgets_PYTHON_BINDINGS)
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR KDDockWidgets_STATIC)
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()
if(CMAKE_UNITY_BUILD)
message(FATAL_ERROR "** Python Bindings are disabled in Unity builds. Try again with CMAKE_UNITY_BUILD=OFF")
message(FATAL_ERROR "** Python Bindings are disabled in Unity builds. " "Try again with CMAKE_UNITY_BUILD=OFF")
endif()
endif()
if(${PROJECT_NAME}_PYTHON_BINDINGS)
add_subdirectory(python)
endif()
if(KDDockWidgets_EXAMPLES)
if(KDDW_FRONTEND_QTQUICK)
if(${PROJECT_NAME}_EXAMPLES)
if(${PROJECT_NAME}_QTQUICK)
add_subdirectory(examples/qtquick)
endif()
if(KDDW_FRONTEND_QTWIDGETS)
else()
add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal)
add_subdirectory(examples/mdi)
add_subdirectory(examples/minimal-mdi)
add_subdirectory(examples/mdi_with_docking)
set_compiler_flags(qtwidgets_dockwidgets)
set_compiler_flags(qtwidgets_minimal)
set_compiler_flags(qtwidgets_mdi_with_docking)
set_target_properties(
qtwidgets_dockwidgets PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
set_target_properties(
qtwidgets_mdi_with_docking PROPERTIES RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
set_target_properties(
qtwidgets_mdi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
set_target_properties(
qtwidgets_minimal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
set_compiler_flags(kddockwidgets_example)
set_compiler_flags(kddockwidgets_minimal_example)
set_compiler_flags(kddockwidgets_mdi_with_docking_example)
endif()
endif()
if(KDDockWidgets_TESTS)
if(KDDockWidgets_DEVELOPER_MODE)
if(${PROJECT_NAME}_TESTS)
if(${PROJECT_NAME}_DEVELOPER_MODE)
add_subdirectory(tests)
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we
# can use threads.
# 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)
@@ -453,37 +377,32 @@ if(KDDockWidgets_TESTS)
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
add_test(NAME tst_view COMMAND tst_view)
add_test(NAME tst_window COMMAND tst_window)
add_test(NAME tst_droparea COMMAND tst_droparea)
add_test(NAME tst_platform COMMAND tst_platform)
add_test(NAME tst_viewguard COMMAND tst_viewguard)
add_test(NAME tst_group COMMAND tst_group)
add_test(NAME tst_titlebar COMMAND tst_titlebar)
add_test(NAME tst_stack COMMAND tst_stack)
add_test(NAME tst_tabbar COMMAND tst_tabbar)
add_test(NAME tst_separator COMMAND tst_separator)
add_test(NAME tst_floatingwindow COMMAND tst_floatingwindow)
add_test(NAME tst_dockwidget COMMAND tst_dockwidget)
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
if(KDDW_FRONTEND_QTWIDGETS)
add_test(NAME tst_qtwidgets COMMAND tst_qtwidgets)
if(NOT ${PROJECT_NAME}_QTQUICK)
# tst_multisplitter depends on QWidget
add_test(NAME tst_multisplitter COMMAND tst_multisplitter)
endif()
if(KDDW_FRONTEND_QTQUICK)
add_test(NAME tst_qtquick COMMAND tst_qtquick)
endif()
endif()
endif()
if(KDDockWidgets_DOCS)
if(${PROJECT_NAME}_DOCS)
add_subdirectory(docs) # needs to go last, in case there are build source files
endif()
if(KDDockWidgets_IS_ROOT_PROJECT)
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
# Add uninstall target (not for submodules since parent projects typically have uninstall too)
include(ECMUninstallTarget)
endif()
# Deployment
if(WIN32)
add_custom_target(
createZipDemo
COMMAND cmd /c ${CMAKE_CURRENT_SOURCE_DIR}\\deploy\\create-demo-win-zip.bat
${CMAKE_PROJECT_NAME}-Demo-${${PROJECT_NAME}_VERSION}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Target to generate the Zip demo installer for Windows"
)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@@ -9,12 +9,11 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "OFF",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick;dummy"
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF"
},
"warnings": {
"uninitialized": true
"warnings" : {
"uninitialized" : true
}
},
{
@@ -26,47 +25,12 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "OFF",
"ECM_ENABLE_SANITIZERS": "'address;undefined'",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick;dummy"
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'"
},
"warnings": {
"uninitialized": true
}
},
{
"name": "dev-flutter",
"displayName": "dev-flutter",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-flutter",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "OFF",
"KDDockWidgets_FRONTENDS": "flutter",
"ECM_ENABLE_SANITIZERS": "'address;undefined'"
},
"warnings": {
"uninitialized": true
}
},
{
"name": "dev-lcov",
"displayName": "dev-lcov",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-lcov",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "OFF",
"KDDockWidgets_CODE_COVERAGE": "ON",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
},
"warnings": {
"uninitialized": true
"warnings" : {
"uninitialized" : true
}
},
{
@@ -77,12 +41,27 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_WERROR": "ON",
"KDDockWidgets_EXAMPLES": "OFF",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick;dummy;flutter"
"KDDockWidgets_EXAMPLES" : "OFF"
},
"environment": {
"CXX": "clazy",
"CCACHE_DISABLE": "ON"
"CCACHE_DISABLE" : "ON"
}
},
{
"name": "clazy-qtquick",
"displayName": "clazy-qtquick",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-clazy-qtquick",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_EXAMPLES" : "OFF",
"KDDockWidgets_WERROR": "ON",
"KDDockWidgets_QTQUICK": "ON"
},
"environment": {
"CXX": "clazy",
"CCACHE_DISABLE" : "ON"
}
},
{
@@ -91,9 +70,7 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_UNITY_BUILD": "OFF",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"CMAKE_BUILD_TYPE": "Release"
}
},
{
@@ -103,9 +80,31 @@
"binaryDir": "${sourceDir}/build-release-no-x11extras",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_UNITY_BUILD": "OFF",
"KDDockWidgets_X11EXTRAS": "OFF",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"KDDockWidgets_X11EXTRAS" : "OFF"
}
},
{
"name": "release-qtquick",
"displayName": "release-qtquick",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-release-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'",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF"
}
},
{
@@ -115,9 +114,7 @@
"binaryDir": "${sourceDir}/build-python",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_PYTHON_BINDINGS": "ON",
"CMAKE_UNITY_BUILD": "OFF",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"KDDockWidgets_PYTHON_BINDINGS": "ON"
}
},
{
@@ -125,10 +122,31 @@
"displayName": "static",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-static",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_STATIC": "ON"
}
},
{
"name": "static6",
"displayName": "static6",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-static6",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_STATIC": "ON",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"KDDockWidgets_QT6": "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"
}
},
{
@@ -139,9 +157,7 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QT6": "ON",
"CMAKE_UNITY_BUILD": "OFF",
"CMAKE_PREFIX_PATH": "$env{QT6_DIR}",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
@@ -156,10 +172,9 @@
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "OFF",
"CMAKE_PREFIX_PATH": "$env{QT6_DIR}",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick;dummy"
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
@@ -174,16 +189,50 @@
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"ECM_ENABLE_SANITIZERS": "'address;undefined'",
"KDDockWidgets_FUZZER": "OFF",
"CMAKE_PREFIX_PATH": "$env{QT6_DIR}",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick;dummy"
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
"KDDockWidgets_FUZZER" : "OFF",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
}
},
{
"name": "release-qtquick6",
"displayName": "release-qtquick6",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-release-qtquick6",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QTQUICK": "ON",
"KDDockWidgets_QT6": "ON",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
}
},
{
"name": "dev-qtquick6",
"displayName": "dev-qtquick6",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-qtquick6",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QTQUICK": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
"KDDockWidgets_QT6": "ON",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"environment": {
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}",
"QML2_IMPORT_PATH" : "$env{QT6_DIR}/imports:$env{QT6_DIR}/qml",
"LD_LIBRARY_PATH" : "$env{QT6_DIR}/lib"
}
},
{
"name": "dev-clangcl",
"displayName": "dev-clangcl",
@@ -192,12 +241,30 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "ON",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "ON"
},
"warnings": {
"uninitialized": true
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang-cl",
"CXX": "clang-cl"
}
},
{
"name": "dev-qtquick-clangcl",
"displayName": "dev-qtquick-clangcl",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-qtquick-clangcl",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"KDDockWidgets_FUZZER" : "OFF",
"KDDockWidgets_QTQUICK": "ON"
},
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang-cl",
@@ -212,13 +279,12 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"KDDockWidgets_FUZZER": "ON",
"KDDockWidgets_FUZZER" : "ON",
"KDDockWidgets_QT6": "ON",
"CMAKE_PREFIX_PATH": "$env{QT6_DIR}",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"warnings": {
"uninitialized": true
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang-cl",
@@ -226,6 +292,30 @@
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}"
}
},
{
"name": "dev-qtquick-clangcl6",
"displayName": "dev-qtquick-clangcl6",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev-qtquick-clangcl6",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"KDDockWidgets_FUZZER" : "OFF",
"KDDockWidgets_QTQUICK": "ON",
"KDDockWidgets_QT6": "ON",
"CMAKE_PREFIX_PATH" : "$env{QT6_DIR}"
},
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang-cl",
"CXX": "clang-cl",
"PATH": "$env{QT6_DIR}/bin:$penv{PATH}",
"QML2_IMPORT_PATH" : "$env{QT6_DIR}/imports:$env{QT6_DIR}/qml",
"LD_LIBRARY_PATH" : "$env{QT6_DIR}/lib"
}
},
{
"name": "dev-time-trace",
"displayName": "dev-time-trace",
@@ -234,19 +324,18 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "OFF",
"CMAKE_C_FLAGS_INIT": "-ftime-trace",
"CMAKE_CXX_FLAGS_INIT": "-ftime-trace",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF",
"CMAKE_C_FLAGS_INIT" : "-ftime-trace",
"CMAKE_CXX_FLAGS_INIT": "-ftime-trace"
},
"warnings": {
"uninitialized": true
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang",
"CXX": "clang++",
"CCACHE_DISABLE": "ON"
"CCACHE_DISABLE" : "ON"
}
},
{
@@ -257,138 +346,107 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"KDDockWidgets_FUZZER": "OFF",
"KDDockWidgets_QT6": "ON",
"CMAKE_C_FLAGS_INIT": "-ftime-trace",
"CMAKE_CXX_FLAGS_INIT": "-ftime-trace",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON",
"KDDockWidgets_FUZZER" : "OFF",
"KDDockWidgets_QT6" : "ON",
"CMAKE_C_FLAGS_INIT" : "-ftime-trace",
"CMAKE_CXX_FLAGS_INIT": "-ftime-trace"
},
"warnings": {
"uninitialized": true
"warnings" : {
"uninitialized" : true
},
"environment": {
"CC": "clang",
"CXX": "clang++",
"CCACHE_DISABLE": "ON"
"CCACHE_DISABLE" : "ON"
}
},
{
"name": "ci-dev-qt5",
"displayName": "ci-dev-qt5",
"description": "Qt5 dev-mode build",
"binaryDir": "${sourceDir}/build-ci-dev-qt5",
"name": "ci-dev-qtwidgets-qt5",
"displayName": "ci-dev-qtwidgets-qt5",
"description": "Qt5 QtWidgets dev-mode build",
"binaryDir": "${sourceDir}/build-ci-dev-qtwidgets-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "ci-dev-qtquick-qt5",
"displayName": "ci-dev-qtquick-qt5",
"description": "Qt5 QtQuick dev-mode build",
"binaryDir": "${sourceDir}/build-ci-dev-qtquick-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
}
},
{
"name": "ci-release-qt5",
"displayName": "ci-release-qt5",
"description": "Qt5 non dev-mode build",
"binaryDir": "${sourceDir}/build-ci-release-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-qtwidgets-qt5",
"displayName": "ci-qtwidgets-qt5",
"description": "Qt5 build which excludes QtQuick",
"description": "Qt5 QtWidgets release build",
"binaryDir": "${sourceDir}/build-ci-qtwidgets-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_FRONTENDS": "qtwidgets"
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "ci-qtquick-qt5",
"displayName": "ci-qtquick-qt5",
"description": "Qt5 build which excludes QtWidgets",
"description": "Qt5 QtQuick release build",
"binaryDir": "${sourceDir}/build-ci-qtquick-qt5",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_FRONTENDS": "qtquick"
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-dummy",
"displayName": "ci-dummy",
"description": "Builds only the dummy frontend. Tests that build passes without Qt.",
"binaryDir": "${sourceDir}/build-ci-dummy",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_FRONTENDS": "dummy",
"KDDockWidgets_QT6": "ON"
}
},
{
"name": "ci-flutter",
"displayName": "ci-flutter",
"description": "Builds only the flutter frontend. Tests that build passes without Qt.",
"binaryDir": "${sourceDir}/build-ci-flutter",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_FRONTENDS": "flutter",
"KDDockWidgets_QT6": "ON"
}
},
{
"name": "ci-dev-qt6",
"displayName": "ci-dev-qt6",
"name": "ci-dev-qtwidgets-qt6",
"displayName": "ci-dev-qtwidgets-qt6",
"description": "Qt6 dev-mode",
"binaryDir": "${sourceDir}/build-ci-dev-qt6",
"binaryDir": "${sourceDir}/build-ci-dev-qtwidgets-qt6",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick",
"KDDockWidgets_QT6": "ON"
}
},
{
"name": "ci-release-qt6",
"description": "Qt6 non dev-mode",
"displayName": "ci-release-qt6",
"binaryDir": "${sourceDir}/build-ci-release-qt6",
"name": "ci-dev-qtquick-qt6",
"displayName": "ci-dev-qtquick-qt6",
"description": "Qt6 dev-mode",
"binaryDir": "${sourceDir}/build-ci-dev-qtquick-qt6",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_DEVELOPER_MODE": "ON",
"CMAKE_BUILD_TYPE": "Debug",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_FRONTENDS": "qtwidgets;qtquick"
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-qtwidgets-qt6",
"description": "Qt6 build which excludes QtQuick",
"description": "Qt6 QtWidgets release build",
"displayName": "ci-qtwidgets-qt6",
"binaryDir": "${sourceDir}/build-ci-qtwidgets-qt6",
"generator": "Ninja",
"cacheVariables": {
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_FRONTENDS": "qtwidgets"
"KDDockWidgets_QT6": "ON"
}
},
{
"name": "ci-qtquick-qt6",
"description": "Qt6 build which excludes QtWidgets",
"description": "Qt6 QtQuick release build",
"displayName": "ci-qtquick-qt6",
"binaryDir": "${sourceDir}/build-ci-qtquick-qt6",
"generator": "Ninja",
@@ -396,8 +454,23 @@
"KDDockWidgets_DEVELOPER_MODE": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"KDDockWidgets_QT6": "ON",
"KDDockWidgets_FRONTENDS": "qtquick"
"KDDockWidgets_QTQUICK": "ON"
}
},
{
"name": "ci-static",
"inherits":["static"],
"binaryDir": "${sourceDir}/build-ci-static"
},
{
"name": "ci-static-qtquick",
"inherits":["static-qtquick"],
"binaryDir": "${sourceDir}/build-ci-static-qtquick"
},
{
"name": "ci-python",
"inherits":["python"],
"binaryDir": "${sourceDir}/build-python"
}
],
"buildPresets": [
@@ -405,8 +478,16 @@
"name": "clazy",
"configurePreset": "clazy",
"environment": {
"CLAZY_CHECKS": "level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo",
"CCACHE_DISABLE": "ON"
"CLAZY_CHECKS" : "level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo",
"CCACHE_DISABLE" : "ON"
}
},
{
"name": "clazy-qtquick",
"configurePreset": "clazy-qtquick",
"environment": {
"CLAZY_CHECKS" : "level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo",
"CCACHE_DISABLE" : "ON"
}
}
]

View File

@@ -1,14 +1,3 @@
* v2.0.0 (unreleased)
- Architecture rewrite to support more frontends besides QtWidgets and QtQuick.
2.0 isn't very interesting for users, but will allow developers to make KDDW
support other GUI frameworks more easily. Also QtQuick is now better integrated,
without being shoehorned with ifdefs into the QtWidgets implementation.
- Split into a view/controller architecture
- Non-gui logic moved to controllers
- Each controller has a gui counter part, implemented for each supported frontend
- Uses nlohmann JSON library (MIT) instead of QJsonDocument, for saving/restoring layouts
- Added Config::setStartDragDistance()
* v1.7.0 (unreleased)
- Introduce DockWidget::setFloatingWindowFlags(flags). Allows for different
FloatingWindows to have different window flags. For example, some having
@@ -54,7 +43,7 @@
- FloatingWindow now honours the dockwidget's max-size, if there's a single
dock widget docked. Tabbed cases are more difficult since QStackedLayout doesn't
propagate size constraints.
- Added MainWindowBase::groupCountChanged()
- Added MainWindowBase::frameCountChanged()
- Introduced Config::setDropIndicatorsInhibited(), which allows you to disable support
for drop indicators while dragging.
- Fixed embedding the main window into a non-kddw main window (#204, #168)

View File

@@ -1,4 +1,4 @@
The KDDockWidgets software is Copyright (C) 2018-2022 Klaralvdalens Datakonsult AB.
The KDDockWidgets software is Copyright (C) 2018-2023 Klaralvdalens Datakonsult AB.
You may use, distribute and copy the KDDockWidgets software under the terms of
the GNU General Public License version 2 or under the terms of GNU General

View File

@@ -1,4 +1,4 @@
KDDockWidgets is (C) 2018-2022, Klarälvdalens Datakonsult AB, and is licensed
KDDockWidgets is (C) 2018-2023, Klarälvdalens Datakonsult AB, and is licensed
according to the terms of the:
GNU General Public License version 2.0 (see LICENSES/GPL-2.0-only.txt)
or the

View File

@@ -2,7 +2,7 @@ GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

View File

@@ -1,9 +0,0 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -2,6 +2,28 @@
These are the instructions for building the Python bindings for KDDockWidgets.
Currently unsupported:
- debug builds
- builds against Qt debug libraries
- static builds
- python2 bindings
- only some 32-bit platforms are supported. see <https://wiki.qt.io/Qt_for_Python>
Also, there are no plans to support the qmake buildsystem.
## Prerequisites
You will need:
- a compiler with C++14 support (C++17 for Qt6 builds)
- Python3.7 or higher
- Qt5 version 5.12 or higher
- Qt6 version 6.2 or higher
- QtForPython provided by the Qt project.
## Install PySide2 for Qt5
Make sure you have PySide2, shiboken2 and shiboken2-generator installed.
As this time, you cannot get shiboken2-generator because the wheels are not on PyPi.
To use the wheels do this:
@@ -13,37 +35,49 @@ To use the wheels do this:
shiboken2 pyside2 shiboken2_generator
```
For more info visit <https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html>.
For more info visit <https://doc.qt.io/qtforpython/shiboken2/gettingstarted.html>
afterwards run:
```bash
pip3 list | grep PySide
```
afterwards run 'pip3 list | grep PySide2'
Note the version *must* match the same Qt you intend to use when building KDDockWidgets.
Not supported:
## Install PySide6 for Qt6
- debug builds
- static builds
- python2 bindings
- only some 32-bit platforms are supported (see <https://wiki.qt.io/Qt_for_Python>)
Follow the same instructions as [the previous section](#Install PySide2 for Qt5),
except installing `shiboken6 pyside6 shiboken6_generator` with pip3.
Tell CMake to build the bindings by passing the `-DKDDockWidgets_PYTHON_BINDINGS=True' option,
followed by the make command.
## Building KDDockWidgets Python Bindings
The bindings will be installed to the passed `-DCMAKE_INSTALL_PREFIX`, which
might require setting the `PYTHONPATH` env variable to point to that path when
running applications. Alternatively, configure the bindings install location
by passing `-DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=/usr/lib/python3.8/site-packages`
to CMake (adjust to the python path on your system).
Tell CMake to build the bindings by passing the `-DKDDockWidgets_PYTHON_BINDINGS=True' option.
Then run `cmake --build` as usual.
The bindings will be installed to `CMAKE_INSTALL_PREFIX`, which might require setting
the `PYTHONPATH` env variable to point to that path when running applications.
For example, if you install to the default location on linux you would:
```bash
export PYTHONPATH=/usr/local/KDAB/KDDockWidgets-1.7.0/lib64/python3.10/site-packages
```
Alternatively, configure the bindings install location by passing (for example)
`-DKDDockWidgets_PYTHON_BINDINGS_INSTALL_PREFIX=/usr/lib/python3.8/site-packages` to CMake
and adjust to the PYTHONPATH accordingly, as necessary.
To run the KDDW python example
```bash
export PYTHONPATH=/kddw/install/path # Only if needed
export PYTHONPATH=/usr/local/KDAB/KDDockWidgets-1.7.0/lib64/python3.10/site-packages # adapt as needed
cd python/examples/
rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
python3 main.py
```
Build Issues
### Build Issues
- If you see errors like "Unable to locate Clang's built-in include directory"
then first mROUBLESHOOTINGake sure you have llvm installed. If you still have problems try

View File

@@ -2,9 +2,10 @@
[![Build Status](https://travis-ci.com/KDAB/KDDockWidgets.svg?branch=master)](https://travis-ci.com/KDAB/KDDockWidgets)
> ⚠️⚠️: 2.0 is under development, there might be API breaks before release.
> Stick with version 1.6 if you're using QtWidgets. However, if you're using
> QtQuick it's better to base on 2.0, as 1.6 won't be receiving much QtQuick development.
![KDDockWidgetsLogo](https://github.com/KDAB/KDDockWidgets/blob/1.7/images/kddockwidgets.png?raw=true)
> ⚠️⚠️: If you're using QtQuick/QML it's recommended to use 2.0 branch. 1.x will continue
> to receive bug fixes for a long time but only for QtWidgets frontend.
`KDDockWidgets` is a Qt dock widget library written by KDAB, suitable for replacing
`QDockWidget` and implementing advanced functionalities missing in Qt.
@@ -13,6 +14,18 @@ Although `KDDockWidgets` is ready to be used out of the box, it can also be seen
as a framework to allow building very tailored custom docking systems. It tries
to expose every internal widget and every knob for the app developer to tune.
You will find more information in these places:
- [our official home page](https://www.kdab.com/development-resources/qt-tools/kddockwidgets)
- [online detailed browsable API reference](https://docs.kdab.com/kddockwidgets)
- [our example programs](examples/)
We also have an [in browser demo](https://demos.kdab.com/wasm/kddockwidgets/dockwidgets.html).
Note however that this demo isn't fully featured, as it's running on Qt for WebAssembly.
Additionally, KDAB can provide pre-built Windows binaries for the example programs.
Contact <info@kdab.com> if interested.
## Motivation
Throughout the years KDAB contributed and funded bug fixes and features to `QDockWidget`.
@@ -23,15 +36,6 @@ and an equal number of days just to fix dozens of regressions.
to move forward with new features. Furthermore, our customers were getting more
creative with their requests, so it was clear we needed a better docking framework.
You will find more information in these places:
- [our official home page](https://www.kdab.com/development-resources/qt-tools/kddockwidgets)
- [online detailed browsable API reference](https://docs.kdab.com/kddockwidgets)
- [our example programs](examples/)
We also have an [in browser demo](https://demos.kdab.com/wasm/kddockwidgets/dockwidgets.html). Note
however that this demo isn't fully featured, as it's running on Qt for WebAssembly.
## Features
- Provide advanced docking that QDockWidget doesn't support
@@ -80,7 +84,7 @@ To build KDDockWidgets you'll need:
- CMake
- Qt 5.15.x or Qt6 >= 6.2
- Ninja (Other generators might work but are untested)
- C++17 capable compiler. Minimum VS2019 on Windows.
- C++17 capable compiler
- Qt Widgets module
- Qt X11Extras module if on Linux/X11
- Qt Quick and QuickControls2 modules if using the QtQuick support
@@ -101,15 +105,6 @@ Adapt the instructions to suit your cmake generator and operating system.
cmake --build . --target install
```
Now build and run the example:
```bash
cd path/to/kddockwidgets/examples/dockwidgets/
cmake -G Ninja -DCMAKE_PREFIX_PATH=/path/where/to/install
cmake --build .
./bin/examples/qtwidgets_dockwidgets
```
The installation directory defaults to `c:\KDAB\KDDockWidgets-<version>` on Windows
and `/usr/local/KDAB/KDDockWidgets-<version>` on non-Windows.
@@ -157,16 +152,18 @@ Please refer to [README-bindings.md](README-bindings.md).
## Versioning
There's currently two lines of development: `v1` which is very mature and stable and `v2` which is an ongoing effort to make
KDDW support multiple "frontends" (QtWidgets, QtQuick and even non-Qt technologies, like flutter).
There's currently two lines of development: `v1` which is very mature and stable and `v2` which is an
ongoing effort to make KDDW support multiple "frontends" (QtWidgets, QtQuick and even non-Qt technologies,
like flutter).
1.x will be supported for many years to come, at least for bug fixes and small features.
Use `v1.6.0` tag for the latest stable.<br>
Use `v1.6.0` tag for the latest stable.
Use `2.0` if you need non-QtWidgets support, for example `QtQuick/QML`. While `1.6` has support for `QtQuick/QML` it won't be receiving bug fixes. `2.0` is under active development, you might encounter minor source/ABI incompatibilities. Despite that,
it is pretty stable, and all 200 unit-tests pass.
Use `2.0` if you need non-QtWidgets support, for example `QtQuick/QML`. While `1.6` has support for `QtQuick/QML`
it won't be receiving bug fixes. `2.0` is under active development, you might encounter minor source/ABI
incompatibilities. Despite that, it is pretty stable, and all 200 unit-tests pass.
We'll try to remain source-compatible across versions (except for the v1 -> v2 jump).<br>
We'll try to remain source-compatible across versions (except for the v1 -> v2 jump).
API will get a deprecation notice before being removed in the next version. Note that this
compatibility effort is only for the public API. Private API (headers ending
in _p.h) might change so you shouldn't depend on them. Private API is only
@@ -179,8 +176,8 @@ your application whenever updating KDDW.
## 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 ViewFactory. Run
"examples/qtwidgets_dockwidgets -p" to see that in action.
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
@@ -192,7 +189,7 @@ headers.
## Licensing
KDDockWidgets is (C) 2019-2022, Klarälvdalens Datakonsult AB, and is licensed according to
KDDockWidgets is (C) 2019-2023, Klarälvdalens Datakonsult AB, and is licensed according to
the terms of the [GPL 2.0](LICENSES/GPL-2.0-only.txt) or [GPL 3.0](LICENSES/GPL-3.0-only.txt).
Contact KDAB at <info@kdab.com> to inquire about commercial licensing.

0
a
View File

View File

@@ -52,9 +52,8 @@ install:
before_build:
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
- cmd: set PATH=C:\Qt\6.3\msvc2019_64\bin;C:\Qt\5.15\msvc2019_64\bin;%PATH%
- sh: export QT_QUICK_BACKEND=software
- sh: if [ "`uname -s`" = "Darwin" ]; then export PATH=$HOME/Qt/6.3/macos/bin:$HOME/Qt/5.15/clang_64/bin:$PATH; else export PATH=$HOME/Qt/6.3/gcc_64/bin:$HOME/Qt/5.15/gcc_64/bin:$PATH; fi
- cmd: set PATH=C:\Qt\6.2\msvc2019_64\bin;C:\Qt\5.15\msvc2019_64\bin;%PATH%
- sh: if [ "`uname -s`" = "Darwin" ]; then export PATH=$HOME/Qt/6.2/macos/bin:$HOME/Qt/5.15/clang_64/bin:$PATH; else export PATH=$HOME/Qt/6.2/gcc_64/bin:$HOME/Qt/5.15/gcc_64/bin:$PATH; fi
build_script:
- mkdir build
@@ -65,7 +64,7 @@ build_script:
- cmd: cmake --build . --target install
- sh: sudo cmake --build . --target install
- cmd: set PATH=.\bin;%PATH%
- ctest --test-dir . -V
- ctest --test-dir .
# to disable automatic builds
#build: off

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2012-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2012-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -30,7 +30,7 @@ if(NOT INSTALL_DATADIR)
set(INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR})
endif()
if(NOT INSTALL_DOC_DIR)
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}${KDDockWidgets_LIBRARY_QTID})
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}${${PROJECT_NAME}_LIBRARY_QTID})
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause

View File

@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2016-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2016-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Allen Winter <allen.winter@kdab.com>
#
# SPDX-License-Identifier: BSD-3-Clause

View File

@@ -0,0 +1,145 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.trimTrailingWhitespace": true,
"editor.formatOnType": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json"
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "gdb-kddockwidgets_customtitlebar_quick",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_customtitlebar_quick",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "gdb-kddockwidgets_example_mdi_quick",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_mdi_quick",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "gdb-kddockwidgets_example_quick",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_quick",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "gdb-tst_docks",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_customtitlebar_quick",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_customtitlebar_quick",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_example_mdi_quick",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_mdi_quick",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_example_quick",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_quick",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-tst_docks",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_customtitlebar_quick",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_customtitlebar_quick",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_example_mdi_quick",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_mdi_quick",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_example_quick",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/kddockwidgets_example_quick",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-tst_docks",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev-qtquick/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
}
]
}
}

View File

@@ -0,0 +1,97 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.trimTrailingWhitespace": true,
"editor.formatOnType": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json"
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "kddockwidgets_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_example",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "kddockwidgets_minimal_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_example",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "kddockwidgets_minimal_mdi_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_mdi_example",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "kddockwidgets_mdi_with_docking_example",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_mdi_with_docking_example",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "tst_docks",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "msvc-kddockwidgets_example",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_example",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_minimal_example",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_example",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_minimal_mdi_example",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/kddockwidgets_minimal_mdi_example",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-tst_docks",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
}
]
}
}

View File

@@ -0,0 +1,145 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.trimTrailingWhitespace": true,
"editor.formatOnType": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json"
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "gdb-kddockwidgets_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "gdb-kddockwidgets_minimal_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "gdb-kddockwidgets_minimal_mdi_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_mdi_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "gdb-tst_docks",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_minimal_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-kddockwidgets_minimal_mdi_example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_mdi_example",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "lldb-tst_docks",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"MIMode": "lldb",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_example",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_example",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_minimal_example",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_example",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-kddockwidgets_minimal_mdi_example",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/kddockwidgets_minimal_mdi_example",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-tst_docks",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
}
]
}
}

View File

@@ -1,176 +0,0 @@
{
"folders": [
{
"name": "kddockwidgets",
"path": "."
},
{
"path": "/data/sources/kddockwidgets-flutter-example"
}
],
"settings": {
"C_Cpp.default.compileCommands": "${workspaceFolder:kddockwidgets}/build-dev/compile_commands.json",
"C_Cpp.default.cStandard": "c17",
"files.trimTrailingWhitespace": true,
"editor.formatOnSave": true,
"C_Cpp.autocompleteAddParentheses": true,
"clangd.arguments": [
"-header-insertion=never"
],
"todo-tree.tree.scanMode": "workspace only",
"todo-tree.tree.disableCompactFolders": false,
"todo-tree.tree.showBadges": true,
"todo-tree.general.tags": [
"BUG",
"HACK",
"FIXME",
"TODO",
"XXX",
"[ ]",
"[x]",
"TODOm2",
"TODOm3",
"TODOm4"
],
"testMate.cpp.test.executables": "{build-dev}/**/*{tst}*",
"todo-tree.filtering.excludeGlobs": [
"**/ECM",
"**/3rdparty"
],
"cmake.copyCompileCommands": "${workspaceFolder:kddockwidgets}/compile_commands.json"
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "qtwidgets_dockwidgets",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/examples/qtwidgets_dockwidgets",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "qtwidgets_minimal",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/examples/qtwidgets_minimal",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "qtwidgets_mdi",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/examples/qtwidgets_mdi",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "qtwidgets_mdi_with_docking",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/examples/qtwidgets_mdi_with_docking",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "qtquick_dockwidgets",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/examples/qtquick_dockwidgets",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "qtquick_customtitlebar",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/examples/qtquick_customtitlebar",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_docks",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_droparea",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_droparea",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_dockwidget",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_dockwidget",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_group",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_group",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_separator",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_separator",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_stack",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_stack",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_tabbar",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_tabbar",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_floatingwindow",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_floatingwindow",
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_qtwidgets",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_qtwidgets",
"args": [
"tst_mainWindowAlwaysHasCentralWidget"
],
"cwd": "${workspaceFolder:kddockwidgets}"
},
{
"name": "tst_qtquick",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder:kddockwidgets}/build-dev/bin/tst_qtquick",
"args": [],
"cwd": "${workspaceFolder:kddockwidgets}"
}
]
}
}

View File

@@ -1,142 +0,0 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"C_Cpp.default.compileCommands": "${workspaceFolder}/build-dev6/compile_commands.json",
"C_Cpp.default.cStandard": "c17",
"files.trimTrailingWhitespace": true,
"editor.formatOnSave": true,
"C_Cpp.autocompleteAddParentheses": true,
"clangd.arguments": [
"-header-insertion=never"
],
"todo-tree.tree.scanMode": "workspace only",
"todo-tree.tree.disableCompactFolders": false,
"todo-tree.tree.showBadges": true,
"todo-tree.filtering.excludeGlobs": [
"**/ECM",
"**/3rdparty"
],
"todo-tree.general.tags": [
"BUG",
"HACK",
"FIXME",
"TODO",
"XXX",
"[ ]",
"[x]",
"TODOm2",
"TODOm3",
"TODOm4"
],
"testMate.cpp.test.executables": "{build-dev6}/**/*{tst}*"
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "qtwidgets_dockwidgets",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtwidgets_dockwidgets",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "qtwidgets_minimal",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtwidgets_minimal",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "qtwidgets_mdi",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtwidgets_mdi",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "qtwidgets_mdi_with_docking",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtwidgets_mdi_with_docking",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "qtquick_dockwidgets",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtquick_dockwidgets",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"name": "tst_docks",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
"args": [
"tst_addMDIDockWidget"
],
"cwd": "${workspaceFolder}"
},
{
"name": "msvc-qtwidgets_dockwidgets",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtwidgets_dockwidgets",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-qtwidgets_minimal",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtwidgets_minimal",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-qtwidgets_mdi",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtwidgets_mdi",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-qtquick_dockwidgets",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/examples/qtquick_dockwidgets.exe",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": "msvc-tst_docks",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dev6/bin/tst_docks",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false
}
]
}
}

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
@@ -12,7 +12,7 @@ from conans import ConanFile, CMake, tools
class KDDockWidgetsConan(ConanFile):
name = "kddockwidgets"
version = "1.5.0"
version = "1.6.95"
default_user = "kdab"
default_channel = "stable"
license = ("https://raw.githubusercontent.com/KDAB/KDDockWidgets/master/LICENSES/GPL-2.0-only.txt",

View File

@@ -0,0 +1,47 @@
@echo off
rem
rem This file is part of KDDockWidgets.
rem
rem SPDX-FileCopyrightText: 2022-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
rem
rem SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
rem
rem Contact KDAB at <info@kdab.com> for commercial licensing options.
rem
rem assumes the builddir is the workdir
rem assumes Qt is in PATH
rem %1 is the name of the deployment
if [%1] == [] (
echo "Usage: %~nx0 <deploymentName>"
goto theEnd
)
rem Prepare the deployDir
set "deploy=%1"
if exist %deploy% (
rmdir /Q /S %deploy%
)
mkdir %deploy%
rem Deploy programs
for %%s in (bin\*.dll bin\*_example.exe) do (
copy %%s %deploy% >nul
)
rem Deploy Qt
windeployqt --compiler-runtime %deploy%
rem Zip it
set zipFile=%cd%\%deploy%.7z
if exist %zipFile% (
del /F /Q %zipFile%
)
7z a %zipFile% %deploy%
rem Must echo this line exactly for the CI
echo Created zip file "%zipFile%" successfully
:theEnd
exit /b %ERRORLEVEL%

View File

@@ -1,3 +1,9 @@
kddockwidgets (1.6.0) release candidate; urgency=high
* 1.6.0 final
-- Allen Winter <allen.winter@kdab.com> Wed, 14 Sep 2022 11:40:00 -0500
kddockwidgets (1.5.0) release candidate; urgency=high
* 1.5.0 final

View File

@@ -1,3 +1,4 @@
#!/usr/bin/make -f
DEB_CMAKE_EXTRA_FLAGS = -DCMAKE_BUILD_TYPE=Release
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk

View File

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

View File

@@ -1,5 +1,5 @@
Name: qt5-kddockwidgets
Version: 1.5.0
Version: 1.6.0
Release: 1
Summary: KDAB's Dock Widget Framework for Qt5
Source0: %{name}-%{version}.tar.gz
@@ -98,6 +98,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
%{_libdir}/libkddockwidgets.so
%changelog
* Wed Sep 14 2022 Allen Winter <allen.winter@kdab.com> 1.6.0
1.6.0 final
* 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

View File

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

View File

@@ -1,5 +1,5 @@
Name: qt6-kddockwidgets
Version: 1.5.0
Version: 1.6.0
Release: 1
Summary: KDAB's Dock Widget Framework for Qt6
Source0: %{name}-%{version}.tar.gz
@@ -18,7 +18,7 @@ BuildRequires: libqt6-qtbase-devel libqt6-qtbase-private-headers-devel libqt6-q
%endif
%if %{defined fedora}
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel desktop-file-utils libxkbcommon-devel
BuildRequires: gcc-c++ qt6-qtbase-devel qt6-qtbase-private-devel desktop-file-utils libxkbcommon-devel util-linux
%endif
%if %{defined rhel}
@@ -79,14 +79,21 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=
%files devel
%defattr(-,root,root,-)
%if 0%{?fedora} > 35
%{_libdir}/qt6/mkspecs/modules/*
%endif
#%dir %{_prefix}/share/mkspecs
#%dir %{_prefix}/share/mkspecs/features
#%{_prefix}/share/mkspecs/features/kddockwidgets.prf
%dir %{_includedir}/kddockwidgets-qt6
%{_includedir}/kddockwidgets-qt6/kddockwidgets/*
%dir %{_libdir}/cmake/KDDockWidgets-qt6
%{_libdir}/cmake/KDDockWidgets-qt6/*
%{_libdir}/libkddockwidgets-qt6.so
#%{_prefix}/mkspecs/modules/* ECMGeneratePriFile isn't ported to Qt6 yet
%changelog
* Wed Sep 14 2022 Allen Winter <allen.winter@kdab.com> 1.6.0
1.6.0 final
* 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

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Sérgio Martins <sergio.martins@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -14,7 +14,7 @@
# $ docker build -t kddw-pyside2 .
# $ docker run -it -v ~/Qt/5.15.2/gcc_64/:/Qt/ -v /tmp/.X11-unix:/tmp/.X11-unix kddw-pyside2
# git checkout 2.0
# git checkout 1.6
# cmake --preset=python -G Ninja . && cd build-python/ && ninja
# Test with:

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Allen Winter <allen.winter@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Allen Winter <allen.winter@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -40,17 +40,16 @@ endif()
file(GLOB _dox_deps *.dox *.html)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
# apidox generation using doxygen
#apidox generation using doxygen
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
add_custom_command(
OUTPUT ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
# handle a bug in doxygen where image files referred to in markdown are not
# copied the output
#handle a bug in doxygen where image files referred to in markdown are not copied the output
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../../screencap.gif
${DOXYGEN_OUTPUT_DIR}/html
# copy some files by-hand that are referred to by the markdown README
#copy some files by-hand that are referred to by the markdown README
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/README-bindings.md ${DOXYGEN_OUTPUT_DIR}/html
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-2.0-only.txt
@@ -68,7 +67,7 @@ add_custom_command(
add_custom_target(
kddockwidgets-api.qch ALL
DEPENDS ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
COMMENT "Target to generate the .qch file"
COMMENT "Target generate the .qch file"
)
add_custom_target(
docs
@@ -80,5 +79,11 @@ set(QCH_INSTALL_DIR
${INSTALL_DOC_DIR}
CACHE STRING "Install location of Qt Assistant help files."
)
install(FILES ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch DESTINATION ${QCH_INSTALL_DIR})
install(FILES ${DOXYGEN_OUTPUT_DIR}/kddockwidgets.tags DESTINATION ${INSTALL_DOC_DIR})
install(
FILES ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
DESTINATION ${QCH_INSTALL_DIR}
)
install(
FILES ${DOXYGEN_OUTPUT_DIR}/kddockwidgets.tags
DESTINATION ${INSTALL_DOC_DIR}
)

View File

@@ -845,6 +845,7 @@ WARN_LOGFILE = doxygen.log
# Note: If this tag is empty the current directory is searched.
INPUT = "@CMAKE_SOURCE_DIR@/README.md" \
"@CMAKE_SOURCE_DIR@/README-bindings.md" \
"@CMAKE_SOURCE_DIR@/src"
# This tag can be used to specify the character encoding of the source files

View File

@@ -1,7 +1,7 @@
<hr>
<div style="float: left;">
<img src="kdab-logo-16x16.png">
<font style="font-weight: bold;">&copy; 2019-2022 Klar&auml;lvdalens Datakonsult AB (KDAB)</font>
<font style="font-weight: bold;">&copy; 2019-2023 Klar&auml;lvdalens Datakonsult AB (KDAB)</font>
<br>
"The Qt, C++ and OpenGL Experts"<br>
<a href="https://www.kdab.com/">https://www.kdab.com/</a>

View File

@@ -1 +0,0 @@
# About

View File

@@ -1,82 +0,0 @@
# Concepts
Before digging into code we need to learn some high level concepts which will make it easy
to learn the API afterwards.
## Views or Widgets
A view, or widget is the most basic GUI element usually provided by your framework.
KDDockWidget's has its roots in the Qt QWidget GUI framework, hence the term widget
will appear in many places. However, since KDDW's goal is to support other GUI toolkits,
we've introduced a more generic term, view.
For the QtWidget frontend, a view will be internally implemented as a QWidget, while for
the QtQuick frontend it will be implemented as a QQuickItem.
## Guest View
This is the view that the user (library user) wants to dock. It has some custom content that
is only relevant for the application. From KDDW's perspective we don't care what's inside,
we'll just help dock it.
## DockWidget
The DockWidget is a visual container for the Guest, in other words, its visual parent.
Visually, DockWidget and Guest might be indistinguishable, except for some margin added by
DockWidget. One reason to have this extra indirection is that it allows us to have a common API
to deal with the Guest. Since guest is provided by the application developer it doesn't have any interface.
## TitleBar
A TitleBar is the area that has the dock widget title and the float and close buttons.
Usually KDDW won't use native OS title bars but draw its own.
## TabBar
DockWidgets can be grouped together in tabs. A tab bar is just a group of tabs.
In Qt this is something like QTabBar.
## Stack
A stack is closely related to TabBar. A stack is a group of dock widgets where only one is visible
at a time, the visible one is controlled by the current tab. In Qt this would be QTabWidget.
## Frame
The Frame is a container that ties the previous concepts all together.
It's composed of 1 or more tabbed DockWidgets, a TitleBar, a Stack and a TabBar.
## Layout
Represents a docking layout. Currently 2 are supported, the traditional nested docking with
resizable splitters (this is the default), implemented by MultiSplitter. And a MDI layout, where
the dock widgets can be arbitrary positioned and even overlap inside an area.
The layouts deal in Frame. You add Frame objects to a layout.
## Separator
A visual separator between two widgets, which allows the user to resize dock widgets with mouse.
## FloatingWindow
When a dock widget isn't embedded into a window it's said to be floating. It's its own
top-level native window. This class ties all the previous together. It contains one layout, which
contains multiple groups.
## MainWindow
Not much different from FloatingWindow technically, but users will often add status bar, tool bar
and menu bars to a main window, while FloatingWindow is just an utility window (Qt::Tool).
MainWindow also has support for a SideBar.
## SideBar
A side bar is a place in the MainWindow where you can "minimize" dock widgets.
It's also called the auto-hide future. When you send a dock widget to the sidebar it will close
but show a button in the sidebar, if you press it, it will show the dock widget as an overlay.
## Drop Indicators
When dragging a dock widgets, KDDW will highlight the places where you can drop it, so
it embeds in the correct position.

View File

@@ -1 +0,0 @@
# Welcome to KDDockWidgets

View File

@@ -1,11 +0,0 @@
# Creating a new frontend
- Copy `src/dummy/` into `src/yourfrontend/`
- Rename the files from `_dummy` to `_yourfrontend`
- Edit `CMakeLists.txt` and `src/CMakeLists.txt`
- Edit the `FrontendType` enum in `KDDockWidgets.h` and add a new enumerator for your frontend
- Edit `Platform::frontendTypes()` in `Platform.cpp` and honour your new enumerator, properly ifdefed
- In `Platform.cpp` add the needed `#include "yourplatform/Platform_yourplatform.h` include
- Edit `Platform::tests_initPlatform()` and add your enumerator
- Edit `Platform_yourfrontend::name()` to return an ID for your frontend
- Run `./bin/tst_platform -tc="Platform::Platform,Platform::name"` , make sure it passes

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -10,20 +10,30 @@
#
cmake_minimum_required(VERSION 3.7)
project(qtwidgets_dockwidgets)
project(kddockwidgets_example)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_example.qrc)
add_executable(qtwidgets_dockwidgets main.cpp MyViewFactory.cpp MyMainWindow.cpp MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
add_executable(
kddockwidgets_example
${RESOURCES_EXAMPLE_SRC}
main.cpp
MyFrameworkWidgetFactory.cpp
MyMainWindow.cpp
MyWidget.cpp
)
target_link_libraries(qtwidgets_dockwidgets PRIVATE KDAB::kddockwidgets)
target_link_libraries(
kddockwidgets_example
PRIVATE KDAB::kddockwidgets
)

View File

@@ -0,0 +1,106 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio 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 "MyFrameworkWidgetFactory.h"
#include "MyTitleBar_CSS.h"
#include <kddockwidgets/FrameworkWidgetFactory.h>
#include <kddockwidgets/private/TabWidget_p.h>
#include <kddockwidgets/private/widgets/FrameWidget_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/multisplitter/Separator_qwidget.h>
#include <QApplication>
// clazy:excludeall=missing-qobject-macro,ctor-missing-parent-argument
class MyTitleBar : public KDDockWidgets::TitleBarWidget
{
public:
explicit MyTitleBar(KDDockWidgets::Frame *frame)
: KDDockWidgets::TitleBarWidget(frame)
{
init();
}
explicit MyTitleBar(KDDockWidgets::FloatingWindow *fw)
: KDDockWidgets::TitleBarWidget(fw)
{
init();
}
~MyTitleBar() override;
void init()
{
setFixedHeight(60);
}
void paintEvent(QPaintEvent *) override
{
QPainter p(this);
QPen pen(Qt::black);
const QColor focusedBackgroundColor = Qt::yellow;
const QColor backgroundColor = focusedBackgroundColor.darker(115);
QBrush brush(isFocused() ? focusedBackgroundColor : backgroundColor);
pen.setWidth(4);
p.setPen(pen);
p.setBrush(brush);
p.drawRect(rect().adjusted(4, 4, -4, -4));
QFont f = qApp->font();
f.setPixelSize(30);
f.setBold(true);
p.setFont(f);
p.drawText(QPoint(10, 40), title());
}
};
MyTitleBar::~MyTitleBar() = default;
// Inheriting from SeparatorWidget instead of Separator as it handles moving and mouse cursor changing
class MySeparator : public Layouting::SeparatorWidget
{
public:
explicit MySeparator(Layouting::Widget *parent)
: Layouting::SeparatorWidget(parent)
{
}
~MySeparator() override;
void paintEvent(QPaintEvent *) override
{
QPainter p(this);
p.fillRect(QWidget::rect(), Qt::cyan);
}
};
MySeparator::~MySeparator() = default;
KDDockWidgets::TitleBar *CustomWidgetFactory::createTitleBar(KDDockWidgets::Frame *frame) const
{
// Feel free to return MyTitleBar_CSS here instead, but just for education purposes!
return new MyTitleBar(frame);
}
KDDockWidgets::TitleBar *CustomWidgetFactory::createTitleBar(KDDockWidgets::FloatingWindow *fw) const
{
// Feel free to return MyTitleBar_CSS here instead, but just for education purposes!
return new MyTitleBar(fw);
}
Layouting::Separator *CustomWidgetFactory::createSeparator(Layouting::Widget *parent) const
{
return new MySeparator(parent);
}

View File

@@ -0,0 +1,27 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio 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.
*/
#pragma once
#include <kddockwidgets/FrameworkWidgetFactory.h>
#include <QPainter>
// clazy:excludeall=ctor-missing-parent-argument
class CustomWidgetFactory : public KDDockWidgets::DefaultWidgetFactory
{
Q_OBJECT
public:
KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::Frame *frame) const override;
KDDockWidgets::TitleBar *createTitleBar(KDDockWidgets::FloatingWindow *fw) const override;
Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const override;
};

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -45,11 +45,11 @@ static MyWidget *newMyWidget()
}
MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
bool dockWidget0IsNonClosable, bool nonDockableDockWidget9,
bool restoreIsRelative, bool maxSizeForDockWidget8,
bool dockwidget5DoesntCloseBeforeRestore, bool dock0BlocksCloseEvent,
bool dockWidget0IsNonClosable, bool nonDockableDockWidget9, bool restoreIsRelative,
bool maxSizeForDockWidget8, bool dockwidget5DoesntCloseBeforeRestore,
bool dock0BlocksCloseEvent,
const QString &affinityName, QWidget *parent)
: KDDockWidgets::Views::MainWindow_qtwidgets(uniqueName, options, parent)
: MainWindow(uniqueName, options, parent)
, m_dockWidget0IsNonClosable(dockWidget0IsNonClosable)
, m_dockWidget9IsNonDockable(nonDockableDockWidget9)
, m_restoreIsRelative(restoreIsRelative)
@@ -73,11 +73,10 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
count++;
auto w = newMyWidget();
w->setGeometry(100, 100, 400, 400);
auto dock = new KDDockWidgets::Views::DockWidget_qtwidgets(
QStringLiteral("new dock %1").arg(count));
auto dock = new KDDockWidgets::DockWidget(QStringLiteral("new dock %1").arg(count));
dock->setWidget(w);
dock->resize(QSize(600, 600));
dock->open();
dock->resize(600, 600);
dock->show();
});
auto saveLayoutAction = fileMenu->addAction(QStringLiteral("Save Layout"));
@@ -104,13 +103,12 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
});
auto layoutEqually = fileMenu->addAction(QStringLiteral("Layout Equally"));
connect(layoutEqually, &QAction::triggered, this, [this] { this->layoutEqually(); });
connect(layoutEqually, &QAction::triggered, this, &MainWindow::layoutEqually);
auto quitAction = fileMenu->addAction(QStringLiteral("Quit"));
connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);
QAction *toggleDropIndicatorSupport =
miscMenu->addAction(QStringLiteral("Toggle Drop Indicator Support"));
QAction *toggleDropIndicatorSupport = miscMenu->addAction(QStringLiteral("Toggle Drop Indicator Support"));
toggleDropIndicatorSupport->setCheckable(true);
toggleDropIndicatorSupport->setChecked(true);
connect(toggleDropIndicatorSupport, &QAction::toggled, this, [](bool checked) {
@@ -136,8 +134,8 @@ void MyMainWindow::createDockWidgets()
const int numDockWidgets = m_dockWidget9IsNonDockable ? 10 : 9;
// Create 9 KDDockWidget::DockWidget and the respective widgets they're hosting (MyWidget
// instances)
// Create 9 KDDockWidget::DockWidget and the respective widgets they're hosting (MyWidget instances)
for (int i = 0; i < numDockWidgets; i++)
m_dockwidgets << newDockWidget();
@@ -159,34 +157,31 @@ void MyMainWindow::createDockWidgets()
m_dockwidgets[6]->addDockWidgetAsTab(m_dockwidgets.at(7));
// Floating windows also support nesting, here we add 8 to the bottom of the group
m_dockwidgets[6]->addDockWidgetToContainingWindow(m_dockwidgets.at(8),
KDDockWidgets::Location_OnBottom);
m_dockwidgets[6]->addDockWidgetToContainingWindow(m_dockwidgets.at(8), KDDockWidgets::Location_OnBottom);
auto floatingWindow = m_dockwidgets.at(6)->rootView();
auto floatingWindow = m_dockwidgets.at(6)->window();
floatingWindow->move(100, 100);
}
KDDockWidgets::Views::DockWidget_qtwidgets *MyMainWindow::newDockWidget()
KDDockWidgets::DockWidgetBase *MyMainWindow::newDockWidget()
{
static int count = 0;
// Passing options is optional, we just want to illustrate Option_NotClosable here
KDDockWidgets::DockWidgetOptions options = KDDockWidgets::DockWidgetOption_None;
KDDockWidgets::LayoutSaverOptions layoutSaverOptions = KDDockWidgets::LayoutSaverOption::None;
KDDockWidgets::DockWidget::Options options = KDDockWidgets::DockWidget::Option_None;
KDDockWidgets::DockWidget::LayoutSaverOptions layoutSaverOptions = KDDockWidgets::DockWidget::LayoutSaverOption::None;
if (count == 0 && m_dockWidget0IsNonClosable)
options |= KDDockWidgets::DockWidgetOption_NotClosable;
options |= KDDockWidgets::DockWidget::Option_NotClosable;
if (count == 9 && m_dockWidget9IsNonDockable)
options |= KDDockWidgets::DockWidgetOption_NotDockable;
options |= KDDockWidgets::DockWidget::Option_NotDockable;
if (count == 5 && m_dockwidget5DoesntCloseBeforeRestore)
layoutSaverOptions |= KDDockWidgets::LayoutSaverOption::Skip;
layoutSaverOptions |= KDDockWidgets::DockWidget::LayoutSaverOption::Skip;
auto dock = new KDDockWidgets::Views::DockWidget_qtwidgets(
QStringLiteral("DockWidget #%1").arg(count), options, layoutSaverOptions);
dock->setAffinities(affinities()); // optional, just to show the feature. Pass -mi to the
// example to see incompatible dock widgets
auto dock = new KDDockWidgets::DockWidget(QStringLiteral("DockWidget #%1").arg(count), options, layoutSaverOptions);
dock->setAffinities(affinities()); // optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
if (count == 1)
dock->setIcon(QIcon::fromTheme(QStringLiteral("mail-message")));
@@ -202,13 +197,13 @@ KDDockWidgets::Views::DockWidget_qtwidgets *MyMainWindow::newDockWidget()
dock->setWidget(myWidget);
if (dock->options() & KDDockWidgets::DockWidgetOption_NotDockable) {
if (dock->options() & KDDockWidgets::DockWidget::Option_NotDockable) {
dock->setTitle(QStringLiteral("DockWidget #%1 (%2)").arg(count).arg("non dockable"));
} else {
dock->setTitle(QStringLiteral("DockWidget #%1").arg(count));
}
dock->resize(QSize(600, 600));
dock->resize(600, 600);
m_toggleMenu->addAction(dock->toggleAction());
dock->toggleAction()->setShortcut(QStringLiteral("ctrl+%1").arg(count));

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -14,22 +14,20 @@
#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindow.h>
class MyMainWindow : public KDDockWidgets::Views::MainWindow_qtwidgets
class MyMainWindow : public KDDockWidgets::MainWindow
{
Q_OBJECT
public:
explicit MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
bool dockWidget0IsNonClosable, bool nonDockableDockWidget9,
bool restoreIsRelative, bool maxSizeForDockWidget8,
bool dockwidget5DoesntCloseBeforeRestore, bool dock0BlocksCloseEvent,
const QString &affinityName = {}, // Usually not needed. Just here to show
// the feature.
bool dockWidget0IsNonClosable, bool nonDockableDockWidget9, bool restoreIsRelative,
bool maxSizeForDockWidget8, bool dockwidget5DoesntCloseBeforeRestore, bool dock0BlocksCloseEvent,
const QString &affinityName = {}, // Usually not needed. Just here to show the feature.
QWidget *parent = nullptr);
~MyMainWindow() override;
private:
void createDockWidgets();
KDDockWidgets::Views::DockWidget_qtwidgets *newDockWidget();
KDDockWidgets::DockWidgetBase *newDockWidget();
QMenu *m_toggleMenu = nullptr;
const bool m_dockWidget0IsNonClosable;
const bool m_dockWidget9IsNonDockable;
@@ -37,5 +35,5 @@ private:
const bool m_maxSizeForDockWidget8;
const bool m_dockwidget5DoesntCloseBeforeRestore;
const bool m_dock0BlocksCloseEvent;
QVector<KDDockWidgets::Views::DockWidget_qtwidgets *> m_dockwidgets;
KDDockWidgets::DockWidget::List m_dockwidgets;
};

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -14,16 +14,15 @@
#pragma once
#include <kddockwidgets/views/TitleBar_qtwidgets.h>
#include <kddockwidgets/controllers/TitleBar.h>
#include <kddockwidgets/private/widgets/TitleBarWidget_p.h>
/**
* @brief Shows how to implement a custom titlebar which uses "Qt StyleSheets".
*
* Derive from KDDockWidgets::ViewFactory_qtwidgets and override the createTitleBar() method.
* Derive from KDDockWidgets::DefaultWidgetFactory and override the two createTitleBar() methods.
*
* To try it out, modify examples/dockwidgets/MyViewFactory.cpp to return a MyTitleBar_CSS instance.
* Run the example with: ./bin/examples/qtwidgets_dockwidgets -p
* To try it out, modify examples/dockwidgets/MyFrameworkWidgetFactory.cpp to return a MyTitleBar_CSS instance.
* Run the example with: ./bin/kddockwidgets_example -p
*
* WARNINGS:
* - Qt StyleSheets are not recommended for new applications. Often you are able to style 90% of
@@ -31,29 +30,27 @@
* - The Qt maintainers have manifested intention to deprecated stylesheets.
* - Stylesheets are supported for built-in QWidgets (QPushButton, QComboBox, etc.), any widget
* that's not in Qt needs to be crafted by the user, that includes, for example, having to paint
* your background manually. KDDockWidget::Views::TitleBar_qtwidgets does this for your
* convenience though.
* your background manually. KDDockWidget::TitleBarWidget does this for your convenience though.
* - Qt stylesheets don't react to property changes (known old bug in Qt), for example:
* QLineEdit[readOnly="true"] { color: gray }
* this won't trigger when readOnly changes to false, you need to set/unset. This is QTBUG-51236
* - KDDockWidget::Views::TitleBar_qtwidgets::isFocused is a property, there for needs to
* workaround the above bug by unsetting the sheet and setting it again.
* - KDDockWidgets::TitleBarWidget::isFocused is a property, there for needs to workaround the
* above bug by unsetting the sheet and setting it again.
*/
class MyTitleBar_CSS : public KDDockWidgets::Views::TitleBar_qtwidgets
class MyTitleBar_CSS : public KDDockWidgets::TitleBarWidget
{
public:
explicit MyTitleBar_CSS(KDDockWidgets::Controllers::TitleBar *controller,
View *parent = nullptr)
: KDDockWidgets::Views::TitleBar_qtwidgets(controller, parent)
explicit MyTitleBar_CSS(KDDockWidgets::Frame *frame)
: KDDockWidgets::TitleBarWidget(frame)
{
initStyleSheet();
connect(controller, &KDDockWidgets::Controllers::TitleBar::isFocusedChanged, this, [this] {
// Workaround QTBUG-51236, this makes the [isFocused=true] syntax useful
setStyleSheet(QString());
initStyleSheet();
});
init();
}
explicit MyTitleBar_CSS(KDDockWidgets::FloatingWindow *fw)
: KDDockWidgets::TitleBarWidget(fw)
{
init();
}
~MyTitleBar_CSS() override;
@@ -70,6 +67,16 @@ public:
"background: green"
"}"));
}
void init()
{
initStyleSheet();
connect(this, &KDDockWidgets::TitleBar::isFocusedChanged, this, [this] {
// Workaround QTBUG-51236, this makes the [isFocused=true] syntax useful
setStyleSheet(QString());
initStyleSheet();
});
}
};
MyTitleBar_CSS::~MyTitleBar_CSS()

View File

@@ -1,93 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio 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 "MyViewFactory.h"
#include "MyTitleBar_CSS.h"
#include <kddockwidgets/views/TitleBar_qtwidgets.h>
#include <kddockwidgets/views/Separator_qtwidgets.h>
#include <QApplication>
#include <QPainter>
// clazy:excludeall=missing-qobject-macro,ctor-missing-parent-argument
class MyTitleBar : public KDDockWidgets::Views::TitleBar_qtwidgets
{
public:
explicit MyTitleBar(KDDockWidgets::Controllers::TitleBar *controller, View *parent = nullptr)
: KDDockWidgets::Views::TitleBar_qtwidgets(controller, parent)
, m_controller(controller)
{
setFixedHeight(60);
}
~MyTitleBar() override;
void paintEvent(QPaintEvent *) override
{
QPainter p(this);
QPen pen(Qt::black);
const QColor focusedBackgroundColor = Qt::yellow;
const QColor backgroundColor = focusedBackgroundColor.darker(115);
QBrush brush(m_controller->isFocused() ? focusedBackgroundColor : backgroundColor);
pen.setWidth(4);
p.setPen(pen);
p.setBrush(brush);
p.drawRect(rect().adjusted(4, 4, -4, -4));
QFont f = qGuiApp->font();
f.setPixelSize(30);
f.setBold(true);
p.setFont(f);
p.drawText(QPoint(10, 40), m_controller->title());
}
private:
KDDockWidgets::Controllers::TitleBar *const m_controller;
};
MyTitleBar::~MyTitleBar() = default;
// Inheriting from SeparatorWidget instead of Separator as it handles moving and mouse cursor
// changing
class MySeparator : public KDDockWidgets::Views::Separator_qtwidgets
{
public:
explicit MySeparator(KDDockWidgets::Controllers::Separator *controller, View *parent)
: KDDockWidgets::Views::Separator_qtwidgets(controller, parent)
{
}
~MySeparator() override;
void paintEvent(QPaintEvent *) override
{
QPainter p(this);
p.fillRect(QWidget::rect(), Qt::cyan);
}
};
MySeparator::~MySeparator() = default;
KDDockWidgets::View *
CustomWidgetFactory::createTitleBar(KDDockWidgets::Controllers::TitleBar *controller,
KDDockWidgets::View *parent) const
{
// Feel free to return MyTitleBar_CSS here instead, but just for education purposes!
return new MyTitleBar(controller, parent);
}
KDDockWidgets::View *
CustomWidgetFactory::createSeparator(KDDockWidgets::Controllers::Separator *controller,
KDDockWidgets::View *parent) const
{
return new MySeparator(controller, parent);
}

View File

@@ -1,26 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio 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.
*/
#pragma once
#include <kddockwidgets/ViewFactory_qtwidgets.h>
// clazy:excludeall=ctor-missing-parent-argument
class CustomWidgetFactory : public KDDockWidgets::ViewFactory_qtwidgets
{
Q_OBJECT
public:
KDDockWidgets::View *createTitleBar(KDDockWidgets::Controllers::TitleBar *,
KDDockWidgets::View *parent) const override;
KDDockWidgets::View *createSeparator(KDDockWidgets::Controllers::Separator *,
KDDockWidgets::View *parent = nullptr) const override;
};

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -62,7 +62,8 @@ void MyWidget::drawLogo(QPainter &p)
const int proposedHeight = int(maxWidth * ratio);
const int width = proposedHeight <= maxHeight ? maxWidth : int(maxHeight / ratio);
const int width = proposedHeight <= maxHeight ? maxWidth
: int(maxHeight / ratio);
const int height = int(width * ratio);
QRect targetLogoRect(0, 0, width, height);
@@ -85,8 +86,7 @@ void MyWidget::closeEvent(QCloseEvent *ev)
}
MyWidget1::MyWidget1(MyWidget::QWidget *parent)
: MyWidget(QStringLiteral(":/assets/triangles.png"),
QStringLiteral(":/assets/KDAB_bubble_white.png"), parent)
: MyWidget(QStringLiteral(":/assets/triangles.png"), QStringLiteral(":/assets/KDAB_bubble_white.png"), parent)
{
}
@@ -112,8 +112,7 @@ void MyWidget2::paintEvent(QPaintEvent *)
}
MyWidget3::MyWidget3(MyWidget::QWidget *parent)
: MyWidget(QStringLiteral(":/assets/base.png"),
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"), parent)
: MyWidget(QStringLiteral(":/assets/base.png"), QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"), parent)
, m_triangle(QImage(QStringLiteral(":/assets/tri.png")))
{
}
@@ -125,8 +124,7 @@ void MyWidget3::paintEvent(QPaintEvent *)
p.drawImage(m_background.rect(), m_background, m_background.rect());
const QRect targetRect =
QRect({ width() - m_triangle.width(), height() - m_triangle.height() }, m_triangle.size());
const QRect targetRect = QRect({ width() - m_triangle.width(), height() - m_triangle.height() }, m_triangle.size());
p.drawImage(targetRect, m_triangle, m_triangle.rect());
drawLogo(p);

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -24,8 +24,7 @@ class MyWidget : public QWidget
{
Q_OBJECT
public:
explicit MyWidget(const QString &backgroundFile, const QString &logoFile,
QWidget *parent = nullptr);
explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr);
~MyWidget();
// These two are just for demonstrating how to block the close event, if desired

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -11,19 +11,16 @@
#include "MyWidget.h"
#include "MyMainWindow.h"
#include "MyViewFactory.h"
#include "MyFrameworkWidgetFactory.h"
#include <algorithm>
#include <kddockwidgets/Config.h>
#include <kddockwidgets/ViewFactory.h>
#include <kddockwidgets/controllers/DockWidget.h>
#include <QStyleFactory>
#include <QApplication>
#include <QDebug>
#include <QCommandLineParser>
#include <algorithm>
// clazy:excludeall=qstring-allocations
using namespace KDDockWidgets;
@@ -35,11 +32,10 @@ int main(int argc, char **argv)
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication app(argc, argv);
app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("Test app"));
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
QCommandLineParser parser;
parser.setApplicationDescription("KDDockWidgets example application");
parser.addHelpOption();
@@ -47,184 +43,110 @@ int main(int argc, char **argv)
// Fusion looks better in general, but feel free to change
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
QCommandLineOption customStyle(
"p",
QCoreApplication::translate("main",
"Shows how to style framework internals via ViewFactory"));
QCommandLineOption customStyle("p", QCoreApplication::translate("main", "Shows how to style framework internals via FrameworkWidgetFactory"));
parser.addOption(customStyle);
QCommandLineOption reorderTabsOption(
"r", QCoreApplication::translate("main", "Support re-ordering tabs with mouse"));
QCommandLineOption reorderTabsOption("r", QCoreApplication::translate("main", "Support re-ordering tabs with mouse"));
parser.addOption(reorderTabsOption);
QCommandLineOption noTitleBars(
"t", QCoreApplication::translate("main", "Hide titlebars when tabs are visible"));
QCommandLineOption noTitleBars("t", QCoreApplication::translate("main", "Hide titlebars when tabs are visible"));
parser.addOption(noTitleBars);
QCommandLineOption alwaysTitleBarWhenFloating(
"q",
QCoreApplication::translate("main",
"Don't hide title bars if floating, even if "
"Flag_HideTitleBarWhenTabsVisible is specified."));
QCommandLineOption alwaysTitleBarWhenFloating("q", QCoreApplication::translate("main", "Don't hide title bars if floating, even if Flag_HideTitleBarWhenTabsVisible is specified."));
parser.addOption(alwaysTitleBarWhenFloating);
QCommandLineOption alwaysTabs(
"z", QCoreApplication::translate("main", "Show tabs even if there's only one"));
QCommandLineOption alwaysTabs("z", QCoreApplication::translate("main", "Show tabs even if there's only one"));
parser.addOption(alwaysTabs);
QCommandLineOption lazyResizeOption("l",
QCoreApplication::translate("main", "Use lazy resize"));
QCommandLineOption lazyResizeOption("l", QCoreApplication::translate("main", "Use lazy resize"));
parser.addOption(lazyResizeOption);
QCommandLineOption multipleMainWindows(
"m", QCoreApplication::translate("main", "Shows two multiple main windows"));
QCommandLineOption multipleMainWindows("m", QCoreApplication::translate("main", "Shows two multiple main windows"));
parser.addOption(multipleMainWindows);
QCommandLineOption incompatibleMainWindows(
"i",
QCoreApplication::translate(
"main",
"Only usable with -m. Make the two main windows incompatible with each other. "
"(Illustrates (MainWindowBase::setAffinityName))"));
QCommandLineOption incompatibleMainWindows("i", QCoreApplication::translate("main", "Only usable with -m. Make the two main windows incompatible with each other. (Illustrates (MainWindowBase::setAffinityName))"));
parser.addOption(incompatibleMainWindows);
QCommandLineOption tabsHaveCloseButton(
"c", QCoreApplication::translate("main", "Tabs have a close button"));
QCommandLineOption tabsHaveCloseButton("c", QCoreApplication::translate("main", "Tabs have a close button"));
parser.addOption(tabsHaveCloseButton);
QCommandLineOption nonClosableDockWidget(
"n", QCoreApplication::translate("main", "DockWidget #0 will be non-closable"));
QCommandLineOption nonClosableDockWidget("n", QCoreApplication::translate("main", "DockWidget #0 will be non-closable"));
parser.addOption(nonClosableDockWidget);
QCommandLineOption relativeRestore(
"s",
QCoreApplication::translate(
"main", "Don't restore main window geometry, restore dock widgets in relative sizes"));
QCommandLineOption relativeRestore("s", QCoreApplication::translate("main", "Don't restore main window geometry, restore dock widgets in relative sizes"));
parser.addOption(relativeRestore);
QCommandLineOption doubleClickMaximize(
"x",
QCoreApplication::translate("main",
"Double clicking a title bar will maximize a floating window"));
QCommandLineOption doubleClickMaximize("x", QCoreApplication::translate("main", "Double clicking a title bar will maximize a floating window"));
parser.addOption(doubleClickMaximize);
QCommandLineOption nonDockable(
"d", QCoreApplication::translate("main", "DockWidget #9 will be non-dockable"));
QCommandLineOption nonDockable("d", QCoreApplication::translate("main", "DockWidget #9 will be non-dockable"));
parser.addOption(nonDockable);
QCommandLineOption maximizeButtonOption(
"b",
QCoreApplication::translate(
"main",
"Floating dockWidgets have maximize/restore buttons instead of float/dock button"));
QCommandLineOption maximizeButtonOption("b", QCoreApplication::translate("main", "Floating dockWidgets have maximize/restore buttons instead of float/dock button"));
parser.addOption(maximizeButtonOption);
QCommandLineOption minimizeButtonOption(
"k",
QCoreApplication::translate("main",
"Floating dockWidgets have a minimize button. Implies not "
"being an utility window (~Qt::Tool)"));
QCommandLineOption minimizeButtonOption("k", QCoreApplication::translate("main", "Floating dockWidgets have a minimize button. Implies not being an utility window (~Qt::Tool)"));
parser.addOption(minimizeButtonOption);
QCommandLineOption segmentedIndicators(
"y", QCoreApplication::translate("main", "Use segmented indicators instead of classical"));
QCommandLineOption segmentedIndicators("y", QCoreApplication::translate("main", "Use segmented indicators instead of classical"));
parser.addOption(segmentedIndicators);
QCommandLineOption noUtilityWindows(
"u",
QCoreApplication::translate(
"main", "FloatingWindows will be normal windows instead of utility windows"));
QCommandLineOption noUtilityWindows("u", QCoreApplication::translate("main", "FloatingWindows will be normal windows instead of utility windows"));
parser.addOption(noUtilityWindows);
QCommandLineOption keepAbove(
"o",
QCoreApplication::translate("main",
"FloatingWindows will have Qt::WindowStaysOnTopHint. Implies "
"not being an utility window (try it with -u too)"));
QCommandLineOption keepAbove("o", QCoreApplication::translate("main", "FloatingWindows will have Qt::WindowStaysOnTopHint. Implies not being an utility window (try it with -u too)"));
parser.addOption(keepAbove);
parser.addPositionalArgument(
"savedlayout",
QCoreApplication::translate("main", "loads the specified json file at startup"));
parser.addPositionalArgument("savedlayout", QCoreApplication::translate("main", "loads the specified json file at startup"));
#ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
QCommandLineOption dockableMainWindows(
"j",
QCoreApplication::translate("main",
"Allow main windows to be docked inside other main windows"));
QCommandLineOption dockableMainWindows("j", QCoreApplication::translate("main", "Allow main windows to be docked inside other main windows"));
parser.addOption(dockableMainWindows);
#endif
QCommandLineOption maxSizeOption(
"g", QCoreApplication::translate("main", "Make dock #8 have a max-size of 200x200."));
QCommandLineOption maxSizeOption("g", QCoreApplication::translate("main", "Make dock #8 have a max-size of 200x200."));
parser.addOption(maxSizeOption);
QCommandLineOption centralFrame(
"f", QCoreApplication::translate("main", "Persistent central group"));
QCommandLineOption centralFrame("f", QCoreApplication::translate("main", "Persistent central frame"));
QCommandLineOption autoHideSupport(
"w",
QCoreApplication::translate("main", "Enables auto-hide/minimization to side-bar support"));
QCommandLineOption autoHideSupport("w", QCoreApplication::translate("main", "Enables auto-hide/minimization to side-bar support"));
parser.addOption(autoHideSupport);
QCommandLineOption closeOnlyCurrentTab(
"close-only-current-tab",
QCoreApplication::translate(
"main",
"The title bar's close button will only close the current tab instead of all. "
"Illustrates using Config::Flag_CloseOnlyCurrentTab"));
QCommandLineOption closeOnlyCurrentTab("close-only-current-tab",
QCoreApplication::translate("main", "The title bar's close button will only close the current tab instead of all. Illustrates using Config::Flag_CloseOnlyCurrentTab"));
parser.addOption(closeOnlyCurrentTab);
QCommandLineOption dontCloseBeforeRestore(
"dont-close-widget-before-restore", // krazy:exclude=spelling
QCoreApplication::translate("main",
"DockWidget #5 won't be closed before a restore. Illustrates "
"LayoutSaverOption::DontCloseBeforeRestore"));
QCommandLineOption dontCloseBeforeRestore("dont-close-widget-before-restore", // krazy:exclude=spelling
QCoreApplication::translate("main", "DockWidget #5 won't be closed before a restore. Illustrates LayoutSaverOption::DontCloseBeforeRestore"));
parser.addOption(dontCloseBeforeRestore);
QCommandLineOption blockCloseEvent(
"block-close-event",
QCoreApplication::translate("main", "DockWidget #0 will block close events"));
QCommandLineOption blockCloseEvent("block-close-event",
QCoreApplication::translate("main", "DockWidget #0 will block close events"));
parser.addOption(blockCloseEvent);
QCommandLineOption showButtonsInTabBarIfTitleBarHidden(
"show-buttons-in-tabbar-if-titlebar-hidden",
QCoreApplication::translate("main",
"If we're not using title bars we'll still show the close and "
"float button in the tab bar"));
QCommandLineOption showButtonsInTabBarIfTitleBarHidden("show-buttons-in-tabbar-if-titlebar-hidden",
QCoreApplication::translate("main", "If we're not using title bars we'll still show the close and float button in the tab bar"));
parser.addOption(showButtonsInTabBarIfTitleBarHidden);
QCommandLineOption centralWidget(
"central-widget",
QCoreApplication::translate("main",
"The main window will have a non-detachable central widget"));
QCommandLineOption centralWidget("central-widget",
QCoreApplication::translate("main", "The main window will have a non-detachable central widget"));
parser.addOption(centralWidget);
QCommandLineOption ctxtMenuOnTabs(
"allow-switch-tabs-via-menu",
QCoreApplication::translate("main", "Allow switching tabs via context menu in tabs area"));
QCommandLineOption ctxtMenuOnTabs("allow-switch-tabs-via-menu",
QCoreApplication::translate("main", "Allow switching tabs via context menu in tabs area"));
parser.addOption(ctxtMenuOnTabs);
QCommandLineOption hideCertainDockingIndicators(
"hide-certain-docking-indicators",
QCoreApplication::translate("main",
"Illustrates usage of Config::setDropIndicatorAllowedFunc()"));
QCommandLineOption hideCertainDockingIndicators("hide-certain-docking-indicators",
QCoreApplication::translate("main", "Illustrates usage of Config::setDropIndicatorAllowedFunc()"));
parser.addOption(hideCertainDockingIndicators);
#if defined(DOCKS_DEVELOPER_MODE)
parser.addOption(centralFrame);
QCommandLineOption noQtTool(
"no-qttool", QCoreApplication::translate("main", "(internal) Don't use Qt::Tool"));
QCommandLineOption noParentForFloating(
"no-parent-for-floating",
QCoreApplication::translate("main", "(internal) FloatingWindows won't have a parent"));
QCommandLineOption nativeTitleBar(
"native-title-bar",
QCoreApplication::translate("main", "(internal) FloatingWindows a native title bar"));
QCommandLineOption noDropIndicators(
"no-drop-indicators",
QCoreApplication::translate("main", "(internal) Don't use any drop indicators"));
QCommandLineOption noQtTool("no-qttool", QCoreApplication::translate("main", "(internal) Don't use Qt::Tool"));
QCommandLineOption noParentForFloating("no-parent-for-floating", QCoreApplication::translate("main", "(internal) FloatingWindows won't have a parent"));
QCommandLineOption nativeTitleBar("native-title-bar", QCoreApplication::translate("main", "(internal) FloatingWindows a native title bar"));
QCommandLineOption noDropIndicators("no-drop-indicators", QCoreApplication::translate("main", "(internal) Don't use any drop indicators"));
parser.addOption(noQtTool);
parser.addOption(noParentForFloating);
@@ -232,8 +154,7 @@ int main(int argc, char **argv)
parser.addOption(noDropIndicators);
#if defined(Q_OS_WIN)
QCommandLineOption noAeroSnap(
"no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
QCommandLineOption noAeroSnap("no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
parser.addOption(noAeroSnap);
#endif
#else
@@ -243,22 +164,22 @@ int main(int argc, char **argv)
parser.process(app);
if (parser.isSet(customStyle)) {
Config::self().setViewFactory(new CustomWidgetFactory()); // Sets our custom factory
Config::self().setFrameworkWidgetFactory(new CustomWidgetFactory()); // Sets our custom factory
// Increase the separator size, just for demo
Config::self().setSeparatorThickness(10);
}
if (parser.isSet(segmentedIndicators))
KDDockWidgets::ViewFactory::s_dropIndicatorType =
KDDockWidgets::DropIndicatorType::Segmented;
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::Segmented;
MainWindowOptions options = MainWindowOption_None;
auto flags = KDDockWidgets::Config::self().flags();
#if defined(DOCKS_DEVELOPER_MODE)
auto internalFlags = KDDockWidgets::Config::self().internalFlags();
options = parser.isSet(centralFrame) ? MainWindowOption_HasCentralFrame : MainWindowOption_None;
options = parser.isSet(centralFrame) ? MainWindowOption_HasCentralFrame
: MainWindowOption_None;
if (parser.isSet(centralWidget))
options |= MainWindowOption_HasCentralWidget;
@@ -276,7 +197,7 @@ int main(int argc, char **argv)
flags |= KDDockWidgets::Config::Flag_NativeTitleBar;
if (parser.isSet(noDropIndicators))
KDDockWidgets::ViewFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
#if defined(Q_OS_WIN)
if (parser.isSet(noAeroSnap))
@@ -306,16 +227,13 @@ int main(int argc, char **argv)
if (parser.isSet(alwaysTitleBarWhenFloating)) {
flags |= KDDockWidgets::Config::Flag_AlwaysTitleBarWhenFloating;
if (!(flags & KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible)) {
qWarning() << "Flag_AlwaysTitleBarWhenFloating is unneeded if "
"Flag_HideTitleBarWhenTabsVisible isn't used."
qWarning() << "Flag_AlwaysTitleBarWhenFloating is unneeded if Flag_HideTitleBarWhenTabsVisible isn't used."
<< "As floating windows already have title bars by default.";
}
}
if (parser.isSet(customStyle) || qEnvironmentVariableIsSet("KDDW_DEBUG_FOCUS"))
flags |= KDDockWidgets::Config::Flag_TitleBarIsFocusable; // also showing title bar focus
// with -p, just to not introduce
// another switch
flags |= KDDockWidgets::Config::Flag_TitleBarIsFocusable; // also showing title bar focus with -p, just to not introduce another switch
if (parser.isSet(reorderTabsOption))
flags |= KDDockWidgets::Config::Flag_AllowReorderTabs;
@@ -346,19 +264,16 @@ int main(int argc, char **argv)
if (parser.isSet(hideCertainDockingIndicators)) {
// Here we exemplify adding a restriction to "Dock Widget 8"
// Dock widget 8 will only be allowed to dock to the outer areas
// Dock widget 8 will only be allowed to dock to the outer areasa
auto func = [](KDDockWidgets::DropLocation location,
const KDDockWidgets::Controllers::DockWidget::List &source,
const KDDockWidgets::Controllers::DockWidget::List &target,
Controllers::DropArea *) {
Q_UNUSED(target); // When dragging into a tab, 'target' would have the list of already
// tabbed dock widgets
const KDDockWidgets::DockWidgetBase::List &source,
const KDDockWidgets::DockWidgetBase::List &target,
KDDockWidgets::DropArea *) {
Q_UNUSED(target); // When dragging into a tab, 'target' would have the list of already tabbed dock widgets
const bool isDraggingDW8 =
std::find_if(source.cbegin(), source.cend(),
[](KDDockWidgets::Controllers::DockWidget *dw) {
return dw->uniqueName() == QLatin1String("DockWidget #8");
})
const bool isDraggingDW8 = std::find_if(source.cbegin(), source.cend(), [](KDDockWidgets::DockWidgetBase *dw) {
return dw->uniqueName() == QLatin1String("DockWidget #8");
})
!= source.cend();
return (location & KDDockWidgets::DropLocation_Outter) || !isDraggingDW8;
@@ -392,21 +307,19 @@ int main(int argc, char **argv)
if (usesMainWindowsWithAffinity) {
if (usesDockableMainWindows) {
qWarning() << "MainWindows with affinity option is incompatible with Dockable Main "
"Windows option";
qWarning() << "MainWindows with affinity option is incompatible with Dockable Main Windows option";
return 1;
}
// By default a dock widget can dock into any main window.
// By setting an affinity name we can prevent that. Dock widgets of different affinities are
// incompatible.
const QString affinity =
parser.isSet(incompatibleMainWindows) ? QStringLiteral("affinity1") : QString();
// By setting an affinity name we can prevent that. Dock widgets of different affinities are incompatible.
const QString affinity = parser.isSet(incompatibleMainWindows) ? QStringLiteral("affinity1")
: QString();
auto mainWindow2 =
new MyMainWindow(QStringLiteral("MyMainWindow-2"), options, nonClosableDockWidget0,
nonDockableDockWidget9, restoreIsRelative, maxSizeForDockWidget8,
dontCloseDockWidget5BeforeRestore, dock0BlocksCloseEvent, affinity);
auto mainWindow2 = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options,
nonClosableDockWidget0, nonDockableDockWidget9,
restoreIsRelative, maxSizeForDockWidget8,
dontCloseDockWidget5BeforeRestore, dock0BlocksCloseEvent, affinity);
if (affinity.isEmpty())
mainWindow2->setWindowTitle("Main Window 2");
else
@@ -415,22 +328,22 @@ int main(int argc, char **argv)
mainWindow2->resize(1200, 1200);
mainWindow2->show();
} else if (usesDockableMainWindows) {
auto mainWindowDockWidget =
new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyMainWindow-2-DW"));
auto mainWindowDockWidget = new DockWidget(QStringLiteral("MyMainWindow-2-DW"));
const QString affinity = QStringLiteral("Inner-DockWidgets-2");
auto dockableMainWindow =
new MyMainWindow(QStringLiteral("MyMainWindow-2"), options, false, false,
restoreIsRelative, false, false, false, affinity);
auto dockableMainWindow = new MyMainWindow(QStringLiteral("MyMainWindow-2"), options,
false, false, restoreIsRelative, false,
false, false, affinity);
dockableMainWindow->setAffinities({ affinity });
dockableMainWindow->setStyleSheet(QStringLiteral("background: yellow"));
dockableMainWindow->setWindowTitle("Dockable Main Window");
dockableMainWindow->show();
mainWindowDockWidget->setWidget(dockableMainWindow);
mainWindowDockWidget->open();
mainWindowDockWidget->resize(QSize(800, 800));
mainWindowDockWidget->show();
mainWindowDockWidget->resize(800, 800);
}
const QStringList args = parser.positionalArguments();

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -10,15 +10,15 @@
#
cmake_minimum_required(VERSION 3.7)
project(qtwidgets_mdi_with_docking)
project(kddockwidgets_mdi_with_docking_example)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
@@ -27,6 +27,12 @@ set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_e
# Just to reuse MyWidget.h
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/)
add_executable(qtwidgets_mdi_with_docking main.cpp ../dockwidgets/MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
add_executable(
kddockwidgets_mdi_with_docking_example
${RESOURCES_EXAMPLE_SRC} ../dockwidgets/MyWidget.cpp main.cpp
)
target_link_libraries(qtwidgets_mdi_with_docking PRIVATE KDAB::kddockwidgets)
target_link_libraries(
kddockwidgets_mdi_with_docking_example
PRIVATE KDAB::kddockwidgets
)

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -11,9 +11,9 @@
#include "MyWidget.h"
#include <kddockwidgets/MainWindow.h>
#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/views/MDIArea_qtwidgets.h>
#include <kddockwidgets/MainWindow.h>
#include <kddockwidgets/MDIArea.h>
#include <QStyleFactory>
#include <QApplication>
@@ -32,16 +32,11 @@ int main(int argc, char **argv)
app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("App supporting both docking and a MDI area"));
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
QCommandLineParser parser;
parser.setApplicationDescription("KDDockWidgets MDI mixed with normal docking");
parser.addHelpOption();
QCommandLineOption nestedDocking(
"n",
QCoreApplication::translate(
"main", "The MDI dock widgets will serve as drop areas, allowing for further nesting"));
QCommandLineOption nestedDocking("n", QCoreApplication::translate("main", "The MDI dock widgets will serve as drop areas, allowing for further nesting"));
parser.addOption(nestedDocking);
parser.process(app);
@@ -51,51 +46,50 @@ int main(int argc, char **argv)
// # 1. Create our main window
KDDockWidgets::Views::MainWindow_qtwidgets mainWindow(
QStringLiteral("MyMainWindow"), KDDockWidgets::MainWindowOption_HasCentralWidget);
KDDockWidgets::MainWindow mainWindow(QStringLiteral("MyMainWindow"), KDDockWidgets::MainWindowOption_HasCentralWidget);
mainWindow.setWindowTitle("Main Window");
mainWindow.resize(1600, 1200);
mainWindow.show();
// # 2. Create a dock widget, it needs a unique name
auto dock1 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock1"));
auto dock1 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock1"));
auto widget1 = new MyWidget1();
dock1->setWidget(widget1);
auto dock2 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock2"));
auto dock2 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock2"));
auto widget2 = new MyWidget2();
dock2->setWidget(widget2);
// # 3. Dock them
mainWindow.addDockWidget(dock1, KDDockWidgets::Location_OnLeft, nullptr,
KDDockWidgets::InitialOption(QSize(300, 0)));
mainWindow.addDockWidget(dock2, KDDockWidgets::Location_OnBottom, nullptr,
KDDockWidgets::InitialOption(QSize(0, 300)));
mainWindow.addDockWidget(dock1, KDDockWidgets::Location_OnLeft, nullptr, KDDockWidgets::InitialOption(QSize(300, 0)));
mainWindow.addDockWidget(dock2, KDDockWidgets::Location_OnBottom, nullptr, KDDockWidgets::InitialOption(QSize(0, 300)));
KDDockWidgets::DockWidgetOptions options = {};
KDDockWidgets::DockWidgetBase::Options options = {};
if (parser.isSet(nestedDocking)) {
options |= KDDockWidgets::DockWidgetOption_MDINestable;
options |= KDDockWidgets::DockWidgetBase::Option_MDINestable;
}
// 4. Create our MDI widgets, which will go into the MDI area
auto mdiWidget1 =
new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MDI widget1"), options);
auto mdiWidget1 = new KDDockWidgets::DockWidget(QStringLiteral("MDI widget1"), options);
mdiWidget1->setWidget(new MyWidget1());
auto mdiWidget2 =
new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MDI widget2"), options);
auto mdiWidget2 = new KDDockWidgets::DockWidget(QStringLiteral("MDI widget2"), options);
mdiWidget2->setWidget(new MyWidget2());
auto mdiWidget3 =
new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MDI widget3"), options);
mdiWidget3->setWidget(new MyWidget3());
auto mdiWidget3 = new KDDockWidgets::DockWidget(QStringLiteral("MDI widget3"), options);
auto widget3 = new MyWidget3();
mdiWidget3->setWidget(widget3);
auto mdiArea = new KDDockWidgets::Views::MDIArea_qtwidgets();
// Just for my personal testing: Overkill to add an option
// widget3->blockCloseEvent();
auto mdiArea = new KDDockWidgets::MDIArea();
mainWindow.setPersistentCentralWidget(mdiArea);
mdiArea->addDockWidget(mdiWidget1, QPoint(10, 10));
mdiArea->addDockWidget(mdiWidget2, QPoint(50, 50));
mdiArea->addDockWidget(mdiWidget3, QPoint(110, 110));
return app.exec();
}

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -10,15 +10,15 @@
#
cmake_minimum_required(VERSION 3.7)
project(qtwidgets_mdi)
project(kddockwidgets_minimal_mdi_example)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
@@ -27,6 +27,12 @@ set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_e
# Just to reuse MyWidget.h
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/)
add_executable(qtwidgets_mdi main.cpp ../dockwidgets/MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
add_executable(
kddockwidgets_minimal_mdi_example
${RESOURCES_EXAMPLE_SRC} ../dockwidgets/MyWidget.cpp main.cpp
)
target_link_libraries(qtwidgets_mdi PRIVATE KDAB::kddockwidgets)
target_link_libraries(
kddockwidgets_minimal_mdi_example
PRIVATE KDAB::kddockwidgets
)

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -11,8 +11,8 @@
#include "MyWidget.h"
#include <kddockwidgets/views/MainWindowMDI_qtwidgets.h>
#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindowMDI.h>
#include <QStyleFactory>
#include <QApplication>
@@ -30,28 +30,26 @@ int main(int argc, char **argv)
app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("Test app"));
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
// Fusion looks better in general, but feel free to change
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
// # 1. Create our main window
KDDockWidgets::Views::MainWindowMDI_qtwidgets mainWindow(QStringLiteral("MyMainWindow"));
KDDockWidgets::MainWindowMDI mainWindow(QStringLiteral("MyMainWindow"));
mainWindow.setWindowTitle("Main Window");
mainWindow.resize(1200, 1200);
mainWindow.show();
// # 2. Create a dock widget, it needs a unique name
auto dock1 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock1"));
auto dock1 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock1"));
auto widget1 = new MyWidget1();
dock1->setWidget(widget1);
auto dock2 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock2"));
auto dock2 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock2"));
auto widget2 = new MyWidget2();
dock2->setWidget(widget2);
auto dock3 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock3"));
auto dock3 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock3"));
auto widget3 = new MyWidget3();
dock3->setWidget(widget3);

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -10,20 +10,26 @@
#
cmake_minimum_required(VERSION 3.7)
project(qtwidgets_minimal)
project(kddockwidgets_minimal_example)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc)
add_executable(qtwidgets_minimal main.cpp MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
add_executable(
kddockwidgets_minimal_example
${RESOURCES_EXAMPLE_SRC} ../dockwidgets/MyWidget.cpp main.cpp
)
target_link_libraries(qtwidgets_minimal PRIVATE KDAB::kddockwidgets)
target_link_libraries(
kddockwidgets_minimal_example
PRIVATE KDAB::kddockwidgets
)

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -61,7 +61,8 @@ void MyWidget::drawLogo(QPainter &p)
const int proposedHeight = int(maxWidth * ratio);
const int width = proposedHeight <= maxHeight ? maxWidth : int(maxHeight / ratio);
const int width = proposedHeight <= maxHeight ? maxWidth
: int(maxHeight / ratio);
const int height = int(width * ratio);
QRect targetLogoRect(0, 0, width, height);
@@ -70,8 +71,7 @@ void MyWidget::drawLogo(QPainter &p)
}
MyWidget1::MyWidget1(MyWidget::QWidget *parent)
: MyWidget(QStringLiteral(":/assets/triangles.png"),
QStringLiteral(":/assets/KDAB_bubble_white.png"), parent)
: MyWidget(QStringLiteral(":/assets/triangles.png"), QStringLiteral(":/assets/KDAB_bubble_white.png"), parent)
{
}
@@ -97,8 +97,7 @@ void MyWidget2::paintEvent(QPaintEvent *)
}
MyWidget3::MyWidget3(MyWidget::QWidget *parent)
: MyWidget(QStringLiteral(":/assets/base.png"),
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"), parent)
: MyWidget(QStringLiteral(":/assets/base.png"), QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"), parent)
, m_triangle(QImage(QStringLiteral(":/assets/tri.png")))
{
}
@@ -110,8 +109,7 @@ void MyWidget3::paintEvent(QPaintEvent *)
p.drawImage(m_background.rect(), m_background, m_background.rect());
const QRect targetRect =
QRect({ width() - m_triangle.width(), height() - m_triangle.height() }, m_triangle.size());
const QRect targetRect = QRect({ width() - m_triangle.width(), height() - m_triangle.height() }, m_triangle.size());
p.drawImage(targetRect, m_triangle, m_triangle.rect());
drawLogo(p);

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -25,8 +25,7 @@ class MyWidget : public QWidget
Q_OBJECT
public:
MyWidget() = default;
explicit MyWidget(const QString &backgroundFile, const QString &logoFile,
QWidget *parent = nullptr);
explicit MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget *parent = nullptr);
~MyWidget();
protected:

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
@@ -11,8 +11,8 @@
#include "MyWidget.h"
#include <kddockwidgets/MainWindow.h>
#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindow.h>
#include <QStyleFactory>
#include <QApplication>
@@ -28,42 +28,41 @@ int main(int argc, char **argv)
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication app(argc, argv);
app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("Test app"));
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
// Fusion looks better in general, but feel free to change
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
// # 1. Create our main window
KDDockWidgets::Views::MainWindow_qtwidgets mainWindow(QStringLiteral("MyMainWindow"));
KDDockWidgets::MainWindow mainWindow(QStringLiteral("MyMainWindow"));
mainWindow.setWindowTitle("Main Window");
mainWindow.resize(1200, 1200);
mainWindow.show();
// # 2. Create a dock widget, it needs a unique name
auto dock1 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock1"));
auto dock1 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock1"));
auto widget1 = new MyWidget();
dock1->setWidget(widget1);
auto dock2 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock2"));
auto dock2 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock2"));
auto widget2 = new MyWidget(QStringLiteral(":/assets/base.png"),
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock2->setWidget(widget2);
auto dock3 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock3"));
auto dock3 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock3"));
auto widget3 = new MyWidget(QStringLiteral(":/assets/base.png"),
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock3->setWidget(widget3);
auto dock4 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock4"));
auto dock4 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock4"));
auto widget4 = new MyWidget(QStringLiteral(":/assets/base.png"),
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock4->setWidget(widget4);
auto dock5 = new KDDockWidgets::Views::DockWidget_qtwidgets(QStringLiteral("MyDock5"));
auto dock5 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock5"));
auto widget5 = new MyWidget(QStringLiteral(":/assets/base.png"),
QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock5->setWidget(widget5);
@@ -81,7 +80,7 @@ int main(int argc, char **argv)
// 5. dock5 will be its own top level (floating window)
dock5->open();
dock5->show();
return app.exec();
}

View File

@@ -1,6 +1,6 @@
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2020-2023 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
@@ -8,24 +8,10 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
add_subdirectory(dockwidgets)
set_compiler_flags(qtquick_dockwidgets)
set_target_properties(
qtquick_dockwidgets PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
add_subdirectory(mdi)
set_compiler_flags(qtquick_mdi)
set_target_properties(qtquick_mdi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/")
add_subdirectory(customtitlebar)
set_compiler_flags(qtquick_customtitlebar)
set_target_properties(
qtquick_customtitlebar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
add_subdirectory(dockwidgets)
add_subdirectory(mdi)
add_subdirectory(customtabbar)
set_compiler_flags(qtquick_customtabbar)
set_target_properties(
qtquick_customtabbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
set_compiler_flags(kddockwidgets_example_quick)
set_compiler_flags(kddockwidgets_example_mdi_quick)
set_compiler_flags(kddockwidgets_customtitlebar_quick)

View File

@@ -1,31 +0,0 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 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.
#
cmake_minimum_required(VERSION 3.7)
project(qtquick_customtabbar)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
add_executable(qtquick_customtabbar main.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(qtquick_customtabbar PRIVATE KDAB::kddockwidgets)

View File

@@ -1,36 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 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.
*/
import QtQuick 2.9
Item {
anchors.fill: parent
property alias background: background.source
property alias logo: logo.source
Image {
id: background
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
Image {
id: logo
fillMode: Image.PreserveAspectFit
anchors {
fill: parent
margins: 50
}
}
}
}

View File

@@ -1,18 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 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.
*/
import QtQuick 2.9
Guest {
anchors.fill: parent
background: "qrc:/assets/triangles.png"
logo: "qrc:/assets/KDAB_bubble_white.png"
}

View File

@@ -1,17 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 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.
*/
import QtQuick 2.9
Guest {
anchors.fill: parent
logo: "qrc:/assets/KDAB_bubble_blue.png"
}

View File

@@ -1,18 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 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.
*/
import QtQuick 2.9
Guest {
anchors.fill: parent
background: "qrc:/assets/base.png"
logo: "qrc:/assets/KDAB_bubble_fulcolor.png"
}

View File

@@ -1,95 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 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.
*/
import QtQuick 2.6
// Will be moved to a plugin in the future, if there's enough demand
import "qrc:/kddockwidgets/qtquick/views/qml/" as KDDW
/// Example of a QML Tab Bar that doesn't use QtQuick.Controls, just for demo purposes.
/// Se the comments named "#HERE#" for important things you shouldn't forget.
KDDW.TabBarBase {
id: root
implicitHeight: 30
currentTabIndex: 0
/// #HERE#. This function required in all derived tab bars. It's called by C++;
/// Returns the tab bar (QQuickItem*) at the specified index.
function getTabAtIndex(index) {
return tabBarRow.children[index];
}
/// #HERE#. This function required in all derived tab bars. It's called by C++;
/// Returns an int, with the index of the tab that's at the specified position.
function getTabIndexAtPosition(globalPoint) {
for (var i = 0; i < tabBarRow.children.length; ++i) {
var tab = tabBarRow.children[i];
var localPt = tab.mapFromGlobal(globalPoint.x, globalPoint.y);
if (tab.contains(localPt)) {
return i;
}
}
return -1;
}
Row {
id: tabBarRow
anchors.fill: parent
spacing: 2
/// Needed only if you want to style hovered tabs differently
property int hoveredIndex: -1;
/// ##HERE## The list of tabs is stored in a C++ model. This repeater populates our tab bar
Repeater {
model: root.groupCpp ? root.groupCpp.tabBar.dockWidgetModel : 0
Rectangle {
id: tab
height: parent.height
width: 100
color: (tabBarRow.hoveredIndex == index) ? "#ba7600" : "orange"
border.color: "black"
// ##HERE## Illustrating how to have a different style in case the tab is current
border.width: index == root.groupCpp.currentIndex ? 3 : 1
// ##HERE## The index of the tab. This is required in all custom tab bar implementations
// It is be used by "getTabAtIndex()" and "getTabIndexAtPosition()" functions
readonly property int tabIndex: index
Text {
anchors.centerIn: parent
text: title
}
/// ##HERE## Tells the C++ backend that the current tab should change
MouseArea {
anchors.fill: parent
onClicked: {
root.currentTabIndex = index;
}
}
}
}
Connections {
target: tabBarCpp
function onHoveredTabIndexChanged(index) {
tabBarRow.hoveredIndex = index;
}
}
}
}

View File

@@ -1,74 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 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/Config.h>
#include <kddockwidgets/views/DockWidget_qtquick.h>
#include <kddockwidgets/Platform_qtquick.h>
#include <kddockwidgets/ViewFactory_qtquick.h>
#include <kddockwidgets/private/DockRegistry.h>
#include <kddockwidgets/views/MainWindow_qtquick.h>
#include <QQuickView>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
class CustomViewFactory : public KDDockWidgets::ViewFactory_qtquick
{
public:
~CustomViewFactory() override;
QUrl tabbarFilename() const override
{
return QUrl("qrc:/MyTabBar.qml");
}
};
CustomViewFactory::~CustomViewFactory() = default;
int main(int argc, char *argv[])
{
#ifdef Q_OS_WIN
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif
QGuiApplication app(argc, argv);
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtQuick);
auto &config = KDDockWidgets::Config::self();
auto flags = config.flags();
config.setFlags(flags);
config.setViewFactory(new CustomViewFactory());
QQmlApplicationEngine appEngine;
KDDockWidgets::Platform_qtquick::instance()->setQmlEngine(&appEngine);
appEngine.load((QUrl("qrc:/main.qml")));
auto dw1 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #1");
dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml"));
auto dw2 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #2");
dw2->setGuestItem(QStringLiteral("qrc:/Guest2.qml"));
auto dw3 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #3");
dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
// Access the main area we created in QML with DockingArea {}
auto mainArea = KDDockWidgets::DockRegistry::self()->mainDockingAreas().constFirst();
mainArea->addDockWidget(dw1, KDDockWidgets::Location_OnTop);
dw1->addDockWidgetAsTab(dw2);
dw1->addDockWidgetAsTab(dw3);
return app.exec();
}

View File

@@ -1,27 +0,0 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 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.
*/
import QtQuick 2.6
import QtQuick.Controls 2.12
import com.kdab.dockwidgets 2.0 as KDDW
ApplicationWindow {
visible: true
width: 1000
height: 800
KDDW.DockingArea {
id: dockWidgetArea
anchors.fill: parent
uniqueName: "MyMainLayout"
}
}

View File

@@ -1,10 +0,0 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>Guest1.qml</file>
<file>Guest2.qml</file>
<file>Guest3.qml</file>
<file>Guest.qml</file>
<file>MyTabBar.qml</file>
</qresource>
</RCC>

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -10,15 +10,15 @@
#
cmake_minimum_required(VERSION 3.7)
project(qtquick_customtitlebar)
project(kddockwidgets_customtitlebar_quick)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
@@ -26,6 +26,12 @@ set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
add_executable(qtquick_customtitlebar main.cpp ${RESOURCES_EXAMPLE_SRC})
add_executable(
kddockwidgets_customtitlebar_quick
${RESOURCES_EXAMPLE_SRC} main.cpp
)
target_link_libraries(qtquick_customtitlebar PRIVATE KDAB::kddockwidgets)
target_link_libraries(
kddockwidgets_customtitlebar_quick
PRIVATE KDAB::kddockwidgets
)

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -10,40 +10,27 @@
*/
import QtQuick 2.9
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 1.5 as QQC1
import com.kdab.dockwidgets 2.0 as KDDW
Item {
anchors.fill: parent
property var background
property var logo
property alias background: background.source
property alias logo: logo.source
KDDW.LayoutSaver {
id: layoutSaver
}
Rectangle {
anchors.fill: parent
color: "green"
Image {
id: background
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
ColumnLayout {
Button {
text: "Save"
onClicked: {
layoutSaver.saveToFile ("/tmp/layout");
}
}
Image {
id: logo
Button {
text: "Restore"
onClicked: {
layoutSaver.restoreFromFile ("/tmp/layout");
}
}
}
}
fillMode: Image.PreserveAspectFit
anchors {
fill: parent
margins: 50
}
}
}
}

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -11,8 +11,8 @@
import QtQuick 2.6
// Will be moved to a plugin in the future, if there's enough demand
import "qrc:/kddockwidgets/qtquick/views/qml/" as KDDW
// Will be moved to a plugin in the future
import "qrc:/kddockwidgets/private/quick/qml/" as KDDW
KDDW.TitleBarBase {
id: root
@@ -32,26 +32,6 @@ KDDW.TitleBarBase {
}
}
Rectangle {
id: floatButton
visible: root.floatButtonVisible
radius: 5
color: "red"
height: root.height - 20
width: height
anchors {
right: closeButton.left
rightMargin: 10
verticalCenter: root.verticalCenter
}
MouseArea {
anchors.fill: parent
onClicked: {
root.floatButtonClicked();
}
}
}
Rectangle {
id: closeButton
enabled: root.closeButtonEnabled

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -11,21 +11,18 @@
#include <kddockwidgets/Config.h>
#include <kddockwidgets/views/DockWidget_qtquick.h>
#include <kddockwidgets/Platform_qtquick.h>
#include <kddockwidgets/ViewFactory_qtquick.h>
#include <kddockwidgets/private/DockRegistry.h>
#include <kddockwidgets/views/MainWindow_qtquick.h>
#include <kddockwidgets/DockWidgetQuick.h>
#include <kddockwidgets/private/DockRegistry_p.h>
#include <kddockwidgets/FrameworkWidgetFactory.h>
#include <QQuickView>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
class CustomViewFactory : public KDDockWidgets::ViewFactory_qtquick
class CustomFrameworkWidgetFactory : public KDDockWidgets::DefaultWidgetFactory
{
public:
~CustomViewFactory() override;
~CustomFrameworkWidgetFactory() override;
QUrl titleBarFilename() const override
{
@@ -33,7 +30,7 @@ public:
}
};
CustomViewFactory::~CustomViewFactory() = default;
CustomFrameworkWidgetFactory::~CustomFrameworkWidgetFactory() = default;
int main(int argc, char *argv[])
{
@@ -41,39 +38,34 @@ int main(int argc, char *argv[])
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif
QGuiApplication app(argc, argv);
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtQuick);
auto &config = KDDockWidgets::Config::self();
auto flags = config.flags();
config.setFlags(flags);
config.setViewFactory(new CustomViewFactory());
config.setFrameworkWidgetFactory(new CustomFrameworkWidgetFactory());
QQmlApplicationEngine appEngine;
KDDockWidgets::Platform_qtquick::instance()->setQmlEngine(&appEngine);
KDDockWidgets::Config::self().setQmlEngine(&appEngine);
appEngine.load((QUrl("qrc:/main.qml")));
auto dw1 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #1");
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml"));
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
dw1->resize(QSize(800, 800));
// dw1->open();
dw1->show();
auto dw2 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #2");
dw2->setGuestItem(QStringLiteral("qrc:/Guest2.qml"));
auto dw2 = new KDDockWidgets::DockWidgetQuick("Dock #2");
dw2->setWidget(QStringLiteral("qrc:/Guest2.qml"));
dw2->resize(QSize(800, 800));
// dw2->open();
dw2->show();
auto dw3 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #3");
dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
auto dw3 = new KDDockWidgets::DockWidgetQuick("Dock #3");
dw3->setWidget(QStringLiteral("qrc:/Guest3.qml"));
// dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
// Access the main area we created in QML with DockingArea {}
auto mainArea = KDDockWidgets::DockRegistry::self()->mainDockingAreas().constFirst();
mainArea->addDockWidget(dw1, KDDockWidgets::Location_OnTop);
mainArea->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
mainArea->addDockWidget(dw3, KDDockWidgets::Location_OnTop);
dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
KDDockWidgets::MainWindowBase *mainWindow = KDDockWidgets::DockRegistry::self()->mainwindows().constFirst();
mainWindow->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
return app.exec();
}

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -11,14 +11,14 @@
import QtQuick 2.6
import QtQuick.Controls 2.12
import com.kdab.dockwidgets 2.0 as KDDW
import com.kdab.dockwidgets 1.0 as KDDW
ApplicationWindow {
visible: true
width: 1000
height: 800
KDDW.DockingArea {
KDDW.MainWindowLayout {
id: dockWidgetArea
anchors.fill: parent

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -10,15 +10,15 @@
#
cmake_minimum_required(VERSION 3.7)
project(qtquick_dockwidgets)
project(kddockwidgets_example_quick)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
@@ -26,6 +26,12 @@ set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
add_executable(qtquick_dockwidgets main.cpp ${RESOURCES_EXAMPLE_SRC})
add_executable(
kddockwidgets_example_quick
${RESOURCES_EXAMPLE_SRC} main.cpp
)
target_link_libraries(qtquick_dockwidgets PRIVATE KDAB::kddockwidgets)
target_link_libraries(
kddockwidgets_example_quick
PRIVATE KDAB::kddockwidgets
)

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -10,7 +10,7 @@
*/
import QtQuick 2.9
import com.kdab.dockwidgets 2.0 as KDDW
import com.kdab.dockwidgets 1.0 as KDDW
Guest {
anchors.fill: parent

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,8 +1,8 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company
<info@kdab.com> Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -11,11 +11,9 @@
#include <kddockwidgets/Config.h>
#include <kddockwidgets/private/DockRegistry.h>
#include <kddockwidgets/ViewFactory.h>
#include <kddockwidgets/Platform_qtquick.h>
#include <kddockwidgets/views/DockWidget_qtquick.h>
#include "kddockwidgets/views/MainWindow_qtquick.h"
#include <kddockwidgets/DockWidgetQuick.h>
#include <kddockwidgets/private/DockRegistry_p.h>
#include <kddockwidgets/FrameworkWidgetFactory.h>
#include <QQmlApplicationEngine>
#include <QGuiApplication>
@@ -31,45 +29,24 @@ int main(int argc, char *argv[])
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QGuiApplication app(argc, argv);
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtQuick);
QCommandLineParser parser;
parser.setApplicationDescription("KDDockWidgets example application");
parser.addHelpOption();
QCommandLineOption noTitleBars(
"t", QCoreApplication::translate("main", "Hide titlebars when tabs are visible"));
parser.addOption(noTitleBars);
QCommandLineOption alwaysTabs(
"z", QCoreApplication::translate("main", "Show tabs even if there's only one"));
parser.addOption(alwaysTabs);
#ifdef Q_OS_WIN
QCommandLineOption nativeTitleBar(
"native-title-bar",
QCoreApplication::translate("main", "(internal) FloatingWindows a native title bar"));
parser.addOption(nativeTitleBar);
#endif
#if defined(DOCKS_DEVELOPER_MODE)
QCommandLineOption noQtTool(
"no-qttool", QCoreApplication::translate("main", "(internal) Don't use Qt::Tool"));
QCommandLineOption noParentForFloating(
"no-parent-for-floating",
QCoreApplication::translate("main", "(internal) FloatingWindows won't have a parent"));
QCommandLineOption noDropIndicators(
"no-drop-indicators",
QCoreApplication::translate("main", "(internal) Don't use any drop indicators"));
QCommandLineOption noQtTool("no-qttool", QCoreApplication::translate("main", "(internal) Don't use Qt::Tool"));
QCommandLineOption noParentForFloating("no-parent-for-floating", QCoreApplication::translate("main", "(internal) FloatingWindows won't have a parent"));
QCommandLineOption nativeTitleBar("native-title-bar", QCoreApplication::translate("main", "(internal) FloatingWindows a native title bar"));
QCommandLineOption noDropIndicators("no-drop-indicators", QCoreApplication::translate("main", "(internal) Don't use any drop indicators"));
parser.addOption(noQtTool);
parser.addOption(noParentForFloating);
parser.addOption(nativeTitleBar);
parser.addOption(noDropIndicators);
#if defined(Q_OS_WIN)
QCommandLineOption noAeroSnap(
"no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
QCommandLineOption noAeroSnap("no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
parser.addOption(noAeroSnap);
#endif
#endif
@@ -86,8 +63,10 @@ int main(int argc, char *argv[])
if (parser.isSet(noParentForFloating))
internalFlags |= KDDockWidgets::Config::InternalFlag_DontUseParentForFloatingWindows;
if (parser.isSet(noDropIndicators))
KDDockWidgets::ViewFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
if (parser.isSet(nativeTitleBar))
flags |= KDDockWidgets::Config::Flag_NativeTitleBar;
else if (parser.isSet(noDropIndicators))
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::None;
#if defined(Q_OS_WIN)
if (parser.isSet(noAeroSnap))
@@ -98,48 +77,35 @@ int main(int argc, char *argv[])
KDDockWidgets::Config::self().setInternalFlags(internalFlags);
#endif
#if defined(Q_OS_WIN)
// On Linux the title bar doesn't send us NonClient mouse events
if (parser.isSet(nativeTitleBar))
flags |= KDDockWidgets::Config::Flag_NativeTitleBar;
#endif
if (parser.isSet(noTitleBars))
flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible;
if (parser.isSet(alwaysTabs))
flags |= KDDockWidgets::Config::Flag_AlwaysShowTabs;
// Set any required flags. The defaults are usually fine.
KDDockWidgets::Config::self().setFlags(flags);
// Create your engine which loads main.qml. A simple QQuickView would work too.
QQmlApplicationEngine appEngine;
KDDockWidgets::Platform_qtquick::instance()->setQmlEngine(&appEngine);
KDDockWidgets::Config::self().setQmlEngine(&appEngine);
appEngine.load((QUrl("qrc:/main.qml")));
// Below we illustrate usage of our C++ API. Alternative you can use declarative API.
// See main.qml for examples of dockwidgets created directly in QML
auto dw1 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #1");
auto dw1 = new KDDockWidgets::DockWidgetQuick("Dock #1");
dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml"));
dw1->setWidget(QStringLiteral("qrc:/Guest1.qml"));
dw1->resize(QSize(800, 800));
dw1->open();
dw1->show();
auto dw2 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #2");
dw2->setGuestItem(QStringLiteral("qrc:/Guest2.qml"));
auto dw2 = new KDDockWidgets::DockWidgetQuick("Dock #2");
dw2->setWidget(QStringLiteral("qrc:/Guest2.qml"));
dw2->resize(QSize(800, 800));
dw2->open();
dw2->show();
auto dw3 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #3");
dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
auto dw3 = new KDDockWidgets::DockWidgetQuick("Dock #3");
dw3->setWidget(QStringLiteral("qrc:/Guest3.qml"));
dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
// Access the main area we created in QML with DockingArea {}
auto mainArea = KDDockWidgets::DockRegistry::self()->mainDockingAreas().constFirst();
mainArea->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
KDDockWidgets::MainWindowBase *mainWindow = KDDockWidgets::DockRegistry::self()->mainwindows().constFirst();
mainWindow->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
return app.exec();
}

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -11,7 +11,7 @@
import QtQuick 2.6
import QtQuick.Controls 2.12
import com.kdab.dockwidgets 2.0 as KDDW
import com.kdab.dockwidgets 1.0 as KDDW
ApplicationWindow {
visible: true
@@ -73,7 +73,7 @@ ApplicationWindow {
}
}
KDDW.DockingArea {
KDDW.MainWindowLayout {
anchors.fill: parent
// Each main layout needs a unique id
@@ -109,13 +109,6 @@ ApplicationWindow {
color: "black"
}
}
KDDW.DockWidget {
id: dock7
uniqueName: "dock7"
Rectangle {
color: "green"
}
}
Component.onCompleted: {
// Add dock4 to the Bottom location
@@ -129,10 +122,6 @@ ApplicationWindow {
// See MainWindowInstantiator_p.h for the API
addDockWidget(dock6, KDDW.KDDockWidgets.Location_OnLeft, null,
Qt.size(500, 100), KDDW.KDDockWidgets.StartHidden);
// dock7 will be tabbed with dock7:
dock5.addDockWidgetAsTab(dock7);
}
}

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# SPDX-FileCopyrightText: 2019-2023 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
@@ -10,15 +10,15 @@
#
cmake_minimum_required(VERSION 3.7)
project(qtquick_mdi)
project(kddockwidgets_example_mdi_quick)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
if(NOT TARGET kddockwidgets)
# This will look for Qt, do find_package yourself manually before if you want
# to look for a specific Qt version for instance.
# This will look for Qt, do find_package yourself manually before
# if you want to look for a specific Qt version for instance.
find_package(KDDockWidgets REQUIRED)
endif()
@@ -26,6 +26,12 @@ set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_mdi_exam
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
add_executable(qtquick_mdi main.cpp ${RESOURCES_EXAMPLE_SRC})
add_executable(
kddockwidgets_example_mdi_quick
${RESOURCES_EXAMPLE_SRC} main.cpp
)
target_link_libraries(qtquick_mdi PRIVATE KDAB::kddockwidgets)
target_link_libraries(
kddockwidgets_example_mdi_quick
PRIVATE KDAB::kddockwidgets
)

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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
@@ -11,7 +11,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.12
import com.kdab.dockwidgets 2.0 as KDDW
import com.kdab.dockwidgets 1.0 as KDDW
Guest {
anchors.fill: parent

View File

@@ -1,7 +1,7 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileCopyrightText: 2020-2023 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

Some files were not shown because too many files have changed in this diff Show More