Merge branch 'master' into 2.0

This commit is contained in:
Allen Winter
2022-07-09 11:08:19 -04:00
41 changed files with 1222 additions and 964 deletions

240
.cmake-format.py Normal file
View File

@@ -0,0 +1,240 @@
# ----------------------------------
# Options affecting listfile parsing
# ----------------------------------
with section("parse"):
# Specify structure for custom cmake functions
additional_commands = {'foo': {'flags': ['BAR', 'BAZ'],
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
# Override configurations per-command where available
override_spec = {}
# Specify variable tags.
vartags = []
# Specify property tags.
proptags = []
# -----------------------------
# Options affecting formatting.
# -----------------------------
with section("format"):
# Disable formatting entirely, making cmake-format a no-op
disable = False
# How wide to allow formatted cmake files
line_width = 120
# How many spaces to tab for indent
tab_size = 4
# If true, lines are indented using tab characters (utf-8 0x09) instead of
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
# require a fractional tab character, the behavior of the fractional
# indentation is governed by <fractional_tab_policy>
use_tabchars = False
# If <use_tabchars> is True, then the value of this variable indicates how
# fractional indentions are handled during whitespace replacement. If set to
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
# to `round-up` fractional indentation is replaced with a single tab character
# (utf-8 0x09) effectively shifting the column to the next tabstop
fractional_tab_policy = 'use-space'
# If an argument group contains more than this many sub-groups (parg or kwarg
# groups) then force it to a vertical layout.
max_subgroups_hwrap = 2
# If a positional argument group contains more than this many arguments, then
# force it to a vertical layout.
max_pargs_hwrap = 6
# If a cmdline positional group consumes more than this many lines without
# nesting, then invalidate the layout (and nest)
max_rows_cmdline = 2
# If true, separate flow control names from their parentheses with a space
separate_ctrl_name_with_space = False
# If true, separate function names from parentheses with a space
separate_fn_name_with_space = False
# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on its own line.
dangle_parens = True
# If the trailing parenthesis must be 'dangled' on its on line, then align it
# to this reference: `prefix`: the start of the statement, `prefix-indent`:
# the start of the statement, plus one indentation level, `child`: align to
# the column of the arguments
dangle_align = 'prefix'
# If the statement spelling length (including space and parenthesis) is
# smaller than this amount, then force reject nested layouts.
min_prefix_chars = 4
# If the statement spelling length (including space and parenthesis) is larger
# than the tab width by more than this amount, then force reject un-nested
# layouts.
max_prefix_chars = 10
# If a candidate layout is wrapped horizontally but it exceeds this many
# lines, then reject the layout.
max_lines_hwrap = 2
# What style line endings to use in the output.
line_ending = 'unix'
# Format command names consistently as 'lower' or 'upper' case
command_case = 'lower'
# Format keywords consistently as 'lower' or 'upper' case
keyword_case = 'upper'
# A list of command names which should always be wrapped
always_wrap = []
# If true, the argument lists which are known to be sortable will be sorted
# lexicographicall
enable_sort = True
# If true, the parsers may infer whether or not an argument list is sortable
# (without annotation).
autosort = False
# By default, if cmake-format cannot successfully fit everything into the
# desired linewidth it will apply the last, most agressive attempt that it
# made. If this flag is True, however, cmake-format will print error, exit
# with non-zero status code, and write-out nothing
require_valid_layout = False
# A dictionary mapping layout nodes to a list of wrap decisions. See the
# documentation for more information.
layout_passes = {}
# ------------------------------------------------
# Options affecting comment reflow and formatting.
# ------------------------------------------------
with section("markup"):
# What character to use for bulleted lists
bullet_char = '*'
# What character to use as punctuation after numerals in an enumerated list
enum_char = '.'
# If comment markup is enabled, don't reflow the first comment block in each
# listfile. Use this to preserve formatting of your copyright/license
# statements.
first_comment_is_literal = False
# If comment markup is enabled, don't reflow any comment block which matches
# this (regex) pattern. Default is `None` (disabled).
literal_comment_pattern = None
# Regular expression to match preformat fences in comments default=
# ``r'^\s*([`~]{3}[`~]*)(.*)$'``
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
# Regular expression to match rulers in comments default=
# ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``
ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
# If a comment line matches starts with this pattern then it is explicitly a
# trailing comment for the preceeding argument. Default is '#<'
explicit_trailing_pattern = '#<'
# If a comment line starts with at least this many consecutive hash
# characters, then don't lstrip() them off. This allows for lazy hash rulers
# where the first hash char is not separated by space
hashruler_min_length = 10
# If true, then insert a space between the first hash char and remaining hash
# chars in a hash ruler, and normalize its length to fill the column
canonicalize_hashrulers = True
# enable comment markup parsing and reflow
enable_markup = False
# ----------------------------
# Options affecting the linter
# ----------------------------
with section("lint"):
# a list of lint codes to disable
disabled_codes = []
# regular expression pattern describing valid function names
function_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid macro names
macro_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid names for variables with global
# (cache) scope
global_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# scope (but internal semantic)
internal_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with local
# scope
local_var_pattern = '[_A-Za-z][A-Za-z0-9_]+'
# regular expression pattern describing valid names for privatedirectory
# variables
private_var_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid names for public directory
# variables
public_var_pattern = '.*'
# regular expression pattern describing valid names for function/macro
# arguments and loop variables.
argument_var_pattern = '[a-z_][a-z0-9_]+'
# regular expression pattern describing valid names for keywords used in
# functions or macros
keyword_pattern = '[A-Z][0-9A-Z_]+'
# In the heuristic for C0201, how many conditionals to match within a loop in
# before considering the loop a parser.
max_conditionals_custom_parser = 2
# Require at least this many newlines between statements
min_statement_spacing = 1
# Require no more than this many newlines between statements
max_statement_spacing = 2
max_returns = 6
max_branches = 15
max_arguments = 10
max_localvars = 15
max_statements = 50
# -------------------------------
# Options affecting file encoding
# -------------------------------
with section("encode"):
# If true, emit the unicode byte-order mark (BOM) at the start of the file
emit_byteorder_mark = False
# Specify the encoding of the input file. Defaults to utf-8
input_encoding = 'utf-8'
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
# only claims to support utf-8 so be careful when using anything else
output_encoding = 'utf-8'
# -------------------------------------
# Miscellaneous configurations options.
# -------------------------------------
with section("misc"):
# A dictionary containing any per-command configuration overrides. Currently
# only `command_case` is supported.
per_command = {}

1
.gitignore vendored
View File

@@ -47,6 +47,7 @@ mylayout.json
*.cbp
*.pyc
/python/examples/rc_assets.py
/python/examples-qt6/rc_assets.py
*.pri
/docks-w
kddockwidgets_minimal_example

4
.krazy
View File

@@ -8,7 +8,7 @@ EXTRA kdabcopyright-reuse,kdabcontactus,fosslicense-reuse
#exclude checks now being done by clazy or clang-tools
EXCLUDE strings,explicit,normalize,passbyvalue,operators,nullstrcompare,nullstrassign,doublequote_chars,qobject,sigsandslots,staticobjects,dpointer,inline,postfixop
exclude spelling as codespell is much, much better tool
#exclude spelling as codespell is much, much better tool
EXCLUDE spelling
#exclude more checks
EXCLUDE style
@@ -20,6 +20,6 @@ SKIP Doxyfile.cmake
SKIP /KDDockWidgetsConfig.cmake.in
#skip more files
SKIP CMakePresets.json
SKIP \.cmake-format\.py
#skip the borrowed code in the cmake subdir
SKIP /cmake/InstallLocation.cmake|/cmake/ECM/|/cmake/KDAB/

2
.pep8 Normal file
View File

@@ -0,0 +1,2 @@
[pycodestyle]
max_line_length = 120

View File

@@ -1,5 +1,6 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: ^(cmake/ECM|cmake/KDAB/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
@@ -14,12 +15,24 @@ repos:
rev: v14.0.0
hooks:
- id: clang-format
- repo: https://github.com/PyCQA/pylint
rev: v2.12.2
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
hooks:
- id: autopep8
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.10
rev: v0.6.13
hooks:
- id: cmake-lint
exclude: (.py.cmake|Doxyfile.cmake)
- id: cmake-format
exclude: (.py.cmake|Doxyfile.cmake)

View File

@@ -139,6 +139,7 @@ disable=print-statement,
deprecated-sys-function,
exception-escape,
comprehension-escape,
consider-using-f-string,
R0801,I1101,E0401
# Enable the message, report, category or checker with the given id(s). You can
@@ -268,7 +269,7 @@ inlinevar-naming-style=any
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=camelCase
method-naming-style=any
# Regular expression matching correct method names. Overrides method-naming-
# style.
@@ -516,7 +517,7 @@ valid-metaclass-classmethod-first-arg=cls
[DESIGN]
# Maximum number of arguments for function / method.
max-args=5
max-args=10
# Maximum number of attributes for a class (see R0902).
max-attributes=7

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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -59,34 +59,34 @@ cmake_minimum_required(VERSION 3.7)
# Allow using a non-KDAB install location.
set(KDAB_INSTALL
True
CACHE INTERNAL "Install to default KDAB Location")
CACHE INTERNAL "Install to default KDAB Location"
)
if(DEFINED CMAKE_INSTALL_PREFIX)
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(KDAB_INSTALL
False
CACHE INTERNAL "Install to non-KDAB Location")
endif()
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(KDAB_INSTALL
False
CACHE INTERNAL "Install to non-KDAB Location"
)
endif()
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
project(KDDockWidgets LANGUAGES CXX)
project(KDDockWidgets LANGUAGES CXX)
else()
project(
KDDockWidgets
DESCRIPTION "An advanced docking system for Qt"
HOMEPAGE_URL "https://github.com/KDAB/KDDockWidgets"
LANGUAGES CXX)
project(
KDDockWidgets
DESCRIPTION "An advanced docking system for Qt"
HOMEPAGE_URL "https://github.com/KDAB/KDDockWidgets"
LANGUAGES CXX
)
endif()
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_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")
include(FeatureSummary)
@@ -98,19 +98,14 @@ 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
"On Linux, link against QtX11Extras so we can detect if the compositor supports transparency. Not applicable to other platforms or Qt6."
ON)
option(
KDDockWidgets_XLib
"On Linux, link against XLib, for a more robust window z-order detection."
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."
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(KDDockWidgets_FRONTENDS "Semicolon separated list of frontends to enable" "")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ECM/modules")
@@ -118,102 +113,93 @@ 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)
set(default_build_type "Debug")
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)
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 the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
if(KDDockWidgets_XLib)
add_definitions(-DKDDockWidgets_XLIB)
add_definitions(-DKDDockWidgets_XLIB)
endif()
if(MSVC AND MSVC_TOOLSET_VERSION LESS 142)
message(FATAL_ERROR "VS 2019 is the minimum required toolset")
message(FATAL_ERROR "VS 2019 is the minimum required toolset")
endif()
if(KDDockWidgets_QT6)
set(Qt_VERSION_MAJOR 6)
set(QT_MIN_VERSION "6.2.0")
set(KDDockWidgets_LIBRARY_QTID "-qt6")
set(Qt_VERSION_MAJOR 6)
set(QT_MIN_VERSION "6.2.0")
set(KDDockWidgets_LIBRARY_QTID "-qt6")
else()
set(Qt_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.15")
set(KDDockWidgets_LIBRARY_QTID "")
set(Qt_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.15")
set(KDDockWidgets_LIBRARY_QTID "")
endif()
# BEGIN frontend enabling
if(KDDockWidgets_FRONTENDS)
set(KDDockWidgets_ALL_FRONTENDS "qtwidgets;qtquick")
set(KDDockWidgets_ALL_FRONTENDS "qtwidgets;qtquick")
foreach(frontend ${KDDockWidgets_FRONTENDS})
if(NOT ${frontend} IN_LIST KDDockWidgets_ALL_FRONTENDS)
message(FATAL_ERROR "Unknown frontend ${frontend}")
endif()
endforeach()
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()
# 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()
# 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()
else()
set(ENABLED_FRONTENDS "")
message("No frontends specified explicitly.")
set(ENABLED_FRONTENDS "")
message("No frontends specified explicitly.")
# qtwidgets
find_package(Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION} NO_MODULE
COMPONENTS Widgets Quick QuickControls2)
# 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()
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()
# 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()
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:")
message("Following frontends have been enabled:")
foreach(frontend ${ENABLED_FRONTENDS})
message("* ${frontend}")
endforeach()
foreach(frontend ${ENABLED_FRONTENDS})
message("* ${frontend}")
endforeach()
endif()
if(KDDockWidgets_DEVELOPER_MODE)
set(KDDW_FRONTEND_DUMMY ON)
set(KDDW_FRONTEND_DUMMY ON)
endif()
# END frontend enabling
@@ -221,42 +207,43 @@ 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})
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)
add_definitions(-DKDDW_FRONTEND_QTWIDGETS)
set(KDDockWidgets_DEPS "widgets")
add_definitions(-DKDDW_FRONTEND_QTWIDGETS)
set(KDDockWidgets_DEPS "widgets")
endif()
if(KDDW_FRONTEND_QTQUICK)
add_definitions(-DKDDW_FRONTEND_QTQUICK)
set(KDDockWidgets_DEPS "${KDDockWidgets_DEPS} quick quickcontrols2")
add_definitions(-DKDDW_FRONTEND_QTQUICK)
set(KDDockWidgets_DEPS "${KDDockWidgets_DEPS} quick quickcontrols2")
endif()
if(NOT WIN32
AND NOT APPLE
AND NOT EMSCRIPTEN
AND NOT KDDockWidgets_QT6
AND KDDockWidgets_X11EXTRAS)
set(KDDockWidgets_DEPS "${KDDockWidgets_DEPS} x11extras")
AND KDDockWidgets_X11EXTRAS
)
set(KDDockWidgets_DEPS "${KDDockWidgets_DEPS} x11extras")
endif()
# Always build the test harness in developer-mode
if(KDDockWidgets_DEVELOPER_MODE)
set(KDDockWidgets_TESTS ON)
set(KDDockWidgets_WERROR ON)
include(ECMEnableSanitizers)
set(KDDockWidgets_TESTS ON)
set(KDDockWidgets_WERROR ON)
include(ECMEnableSanitizers)
# find_package(doctest REQUIRED) TODOm3
# find_package(doctest REQUIRED) TODOm3
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(IS_CLANG_BUILD TRUE)
set(IS_CLANG_BUILD TRUE)
else()
set(IS_CLANG_BUILD FALSE)
set(IS_CLANG_BUILD FALSE)
endif()
set(CMAKE_CXX_STANDARD 17)
@@ -270,238 +257,230 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
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)
target_compile_definitions(
${targetName}
PUBLIC DOCKS_DEVELOPER_MODE
PRIVATE QT_FORCE_ASSERTS)
if(KDDockWidgets_DEVELOPER_MODE)
target_compile_definitions(
${targetName}
PUBLIC DOCKS_DEVELOPER_MODE
PRIVATE QT_FORCE_ASSERTS
)
if(NOT MSVC)
target_compile_options(${targetName} PRIVATE -Wall -Wextra)
if(NOT MSVC)
target_compile_options(${targetName} PRIVATE -Wall -Wextra)
endif()
if(APPLE)
target_compile_options(${targetName} PRIVATE -Wweak-vtables)
endif()
endif()
if(APPLE)
target_compile_options(${targetName} PRIVATE -Wweak-vtables)
# Enable -Werror
if(KDDockWidgets_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()
endif()
# Enable -Werror
if(KDDockWidgets_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()
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE)
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32))
# Linker warnings should be treated as errors
set(CMAKE_SHARED_LINKER_FLAGS
"-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS
"-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32)
)
# Linker warnings should be treated as errors
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE)
else()
set(sanitizers_enabled FALSE)
endif()
if(APPLE OR LINUX)
# cannot enable this for clang + sanitizers
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Do not allow undefined symbols, even in non-symbolic shared libraries
set(CMAKE_SHARED_LINKER_FLAGS
"-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS
"-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
if("${CMAKE_CXX_FLAGS} ${${compileflawithgs}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE)
else()
set(sanitizers_enabled FALSE)
endif()
if(APPLE OR LINUX)
# cannot enable this for clang + sanitizers
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Do not allow undefined symbols, even in non-symbolic shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
endif()
endif()
endif()
endif()
if(KDDockWidgets_STATIC)
set(KDDockWidgets_LIBRARY_MODE "STATIC")
set(KDDockWidgets_LIBRARY_MODE "STATIC")
else()
set(KDDockWidgets_LIBRARY_MODE "SHARED")
set(KDDockWidgets_LIBRARY_MODE "SHARED")
endif()
if(KDAB_INSTALL)
if(UNIX)
set(CMAKE_INSTALL_PREFIX
"/usr/local/KDAB/KDDockWidgets-${KDDockWidgets_VERSION}"
CACHE INTERNAL "Install to default KDAB Location")
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX
"C:\\KDAB\\KDDockWidgets-${KDDockWidgets_VERSION}"
CACHE INTERNAL "Install to default KDAB Location")
endif()
if(UNIX)
set(CMAKE_INSTALL_PREFIX
"/usr/local/KDAB/KDDockWidgets-${KDDockWidgets_VERSION}"
CACHE INTERNAL "Install to default KDAB Location"
)
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX
"C:\\KDAB\\KDDockWidgets-${KDDockWidgets_VERSION}"
CACHE INTERNAL "Install to default KDAB Location"
)
endif()
endif()
# setup default install locations
include(InstallLocation)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(KDDockWidgets_IS_ROOT_PROJECT TRUE)
set(KDDockWidgets_IS_ROOT_PROJECT TRUE)
message(
STATUS
"Building KDDockWidgets ${KDDockWidgets_VERSION} in ${CMAKE_BUILD_TYPE} mode. Installing to ${CMAKE_INSTALL_PREFIX}"
)
message(STATUS "Building KDDockWidgets ${KDDockWidgets_VERSION} in ${CMAKE_BUILD_TYPE} mode. "
"Installing to ${CMAKE_INSTALL_PREFIX}"
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
install(FILES LICENSE.txt README.md DESTINATION ${INSTALL_DOC_DIR})
install(DIRECTORY LICENSES DESTINATION ${INSTALL_DOC_DIR})
# Generate .pri file for qmake users TODO: ECM does not support Qt6 yet
if(Qt_VERSION_MAJOR EQUAL 5
AND CMAKE_VERSION VERSION_GREATER "3.11.99"
AND NOT CMAKE_CONFIGURATION_TYPES) # Not working with VS generator or older
# cmake versions
include(ECMGeneratePriFile)
set(PROJECT_VERSION_STRING ${KDDockWidgets_VERSION})
ecm_generate_pri_file(
BASE_NAME
KDDockWidgets
LIB_NAME
kddockwidgets
DEPS
${KDDockWidgets_DEPS}
FILENAME_VAR
pri_filename
INCLUDE_INSTALL_DIR
${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
endif()
# Generate .pri file for qmake users
# TODO: ECM does not support Qt6 yet, nor with VS generator or older cmake versions
if(Qt_VERSION_MAJOR EQUAL 5
AND CMAKE_VERSION VERSION_GREATER "3.11.99"
AND NOT CMAKE_CONFIGURATION_TYPES
)
include(ECMGeneratePriFile)
set(PROJECT_VERSION_STRING ${KDDockWidgets_VERSION})
ecm_generate_pri_file(
BASE_NAME
KDDockWidgets
LIB_NAME
kddockwidgets
DEPS
${KDDockWidgets_DEPS}
FILENAME_VAR
pri_filename
INCLUDE_INSTALL_DIR
${CMAKE_INSTALL_INCLUDEDIR}
)
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
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(KDDockWidgets_IS_ROOT_PROJECT FALSE)
set(KDDockWidgets_TESTS FALSE)
set(KDDockWidgets_EXAMPLES FALSE)
set(KDDockWidgets_DOCS FALSE)
endif()
if(KDDockWidgets_TESTS)
enable_testing()
enable_testing()
endif()
add_subdirectory(src)
if(KDDockWidgets_PYTHON_BINDINGS)
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR KDDockWidgets_STATIC)
message(
FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
endif()
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR KDDockWidgets_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")
endif()
if(CMAKE_UNITY_BUILD)
message(FATAL_ERROR "** Python Bindings are disabled in Unity builds. Try again with CMAKE_UNITY_BUILD=OFF")
endif()
add_subdirectory(python)
add_subdirectory(python)
endif()
if(KDDockWidgets_EXAMPLES)
if(KDDW_FRONTEND_QTQUICK)
add_subdirectory(examples/qtquick)
endif()
if(KDDW_FRONTEND_QTQUICK)
add_subdirectory(examples/qtquick)
endif()
if(KDDW_FRONTEND_QTWIDGETS)
add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal)
add_subdirectory(examples/mdi)
add_subdirectory(examples/mdi_with_docking)
set_compiler_flags(qtwidgets_dockwidgets)
set_compiler_flags(qtwidgets_minimal)
set_compiler_flags(qtwidgets_mdi_with_docking)
if(KDDW_FRONTEND_QTWIDGETS)
add_subdirectory(examples/dockwidgets)
add_subdirectory(examples/minimal)
add_subdirectory(examples/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/")
endif()
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/"
)
endif()
endif()
if(KDDockWidgets_TESTS)
if(KDDockWidgets_DEVELOPER_MODE)
add_subdirectory(tests)
if(KDDockWidgets_DEVELOPER_MODE)
add_subdirectory(tests)
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we
# can use threads.
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for
# rounding leftovers
# tst_docks.exe is pretty big (160 tests), so split it in more runs so we
# can use threads.
add_test(NAME tst_docks0 COMMAND tests_launcher 0 5)
add_test(NAME tst_docks1 COMMAND tests_launcher 1 5)
add_test(NAME tst_docks2 COMMAND tests_launcher 2 5)
add_test(NAME tst_docks3 COMMAND tests_launcher 3 5)
add_test(NAME tst_docks4 COMMAND tests_launcher 4 5)
add_test(NAME tst_docks5 COMMAND tests_launcher 5 5)
add_test(NAME tst_docks6 COMMAND tests_launcher 6 5)
add_test(NAME tst_docks7 COMMAND tests_launcher 7 5)
add_test(NAME tst_docks8 COMMAND tests_launcher 8 5)
add_test(NAME tst_docks9 COMMAND tests_launcher 9 5)
add_test(NAME tst_docks10 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks11 COMMAND tests_launcher 10 5)
add_test(NAME tst_docks12 COMMAND tests_launcher 11 5)
add_test(NAME tst_docks13 COMMAND tests_launcher 12 5)
add_test(NAME tst_docks14 COMMAND tests_launcher 13 5)
add_test(NAME tst_docks15 COMMAND tests_launcher 14 5)
add_test(NAME tst_docks16 COMMAND tests_launcher 15 5)
add_test(NAME tst_docks17 COMMAND tests_launcher 16 5)
add_test(NAME tst_docks18 COMMAND tests_launcher 17 5)
add_test(NAME tst_docks19 COMMAND tests_launcher 18 5)
add_test(NAME tst_docks20 COMMAND tests_launcher 19 5)
add_test(NAME tst_docks21 COMMAND tests_launcher 20 5) # one more for rounding leftovers
add_test(NAME tst_view COMMAND tst_view)
add_test(NAME tst_window COMMAND tst_window)
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)
add_test(NAME tst_view COMMAND tst_view)
add_test(NAME tst_window COMMAND tst_window)
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(KDDW_FRONTEND_QTWIDGETS)
add_test(NAME tst_qtwidgets COMMAND tst_qtwidgets)
endif()
if(KDDW_FRONTEND_QTQUICK)
add_test(NAME tst_qtquick COMMAND tst_qtquick)
endif()
endif()
if(KDDW_FRONTEND_QTQUICK)
add_test(NAME tst_qtquick COMMAND tst_qtquick)
endif()
endif()
endif()
if(KDDockWidgets_DOCS)
add_subdirectory(docs) # needs to go last, in case there are build source
# files
add_subdirectory(docs) # needs to go last, in case there are build source files
endif()
if(KDDockWidgets_IS_ROOT_PROJECT)
# Add uninstall target (not for submodules since parent projects typically
# have uninstall too)
include(ECMUninstallTarget)
# Add uninstall target (not for submodules since parent projects typically have uninstall too)
include(ECMUninstallTarget)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES
FATAL_ON_MISSING_REQUIRED_PACKAGES)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@@ -9,27 +9,27 @@
include(GNUInstallDirs)
if(NOT INSTALL_RUNTIME_DIR)
set(INSTALL_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR})
set(INSTALL_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR})
endif()
if(NOT INSTALL_LIBRARY_DIR)
set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT INSTALL_ARCHIVE_DIR)
set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT INSTALL_INCLUDE_DIR)
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
endif()
if(NOT INSTALL_DATADIR)
set(INSTALL_DATADIR ${CMAKE_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}${KDDockWidgets_LIBRARY_QTID})
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_MACOSX_RPATH ON)
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${INSTALL_LIBRARY_DIR}")
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${INSTALL_LIBRARY_DIR}")
endif()

View File

@@ -9,6 +9,7 @@
from conans import ConanFile, CMake, tools
class KDDockWidgetsConan(ConanFile):
name = "kddockwidgets"
version = "1.5.0"
@@ -20,7 +21,7 @@ class KDDockWidgetsConan(ConanFile):
url = "https://github.com/KDAB/KDDockWidgets"
description = "Advanced Dock Widget Framework for Qt"
generators = "cmake"
topics = ("qt", "dockwidget" , "kdab")
topics = ("qt", "dockwidget", "kdab")
settings = "os", "compiler", "build_type", "arch"
options = {
"qt_version": "ANY",
@@ -65,4 +66,5 @@ class KDDockWidgetsConan(ConanFile):
self.env_info.CMAKE_PREFIX_PATH.append(self.package_folder)
def package_id(self):
self.info.requires["qt"].minor_mode() # Check only the major and minor version!
# Check only the major and minor version!
self.info.requires["qt"].minor_mode()

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: Allen Winter <allen.winter@kdab.com>
# SPDX-FileCopyrightText: 2020-2022 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
#
@@ -12,12 +12,13 @@
# Doxygen
find_package(Doxygen)
set_package_properties(
Doxygen PROPERTIES
TYPE OPTIONAL
DESCRIPTION "API Documentation system"
URL "https://www.doxygen.org"
PURPOSE "Needed to build the API documentation.")
Doxygen PROPERTIES
TYPE OPTIONAL
DESCRIPTION "API Documentation system"
URL "https://www.doxygen.org"
PURPOSE "Needed to build the API documentation."
)
if(DOXYGEN_FOUND)
add_subdirectory(api)
add_subdirectory(api)
endif()

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: Allen Winter <allen.winter@kdab.com>
# SPDX-FileCopyrightText: 2020-2022 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
#
@@ -11,81 +11,74 @@
# dot should come with Doxygen find_package(Doxygen)
if(DOXYGEN_DOT_EXECUTABLE)
set(HAVE_DOT "YES")
set(HAVE_DOT "YES")
else()
set(HAVE_DOT "NO")
message(
STATUS
"Unable to provide inheritance diagrams for the API documentation. To fix, install the graphviz project from https://www.graphviz.org"
)
set(HAVE_DOT "NO")
message(STATUS "Unable to provide inheritance diagrams for the API documentation. "
"To fix, install the graphviz project from https://www.graphviz.org"
)
endif()
# qhelpgenerator
find_program(QHELPGEN_EXECUTABLE qhelpgenerator HINTS ${QT_INSTALL_BINS})
if(QHELPGEN_EXECUTABLE)
set(HAVE_QHELPGEN "YES")
set(HAVE_QHELPGEN "YES")
else()
set(HAVE_QHELPGEN "NO")
message(
STATUS
"Unable to generate the API documentation in qch format. To fix, install the qthelpgenerator program which comes with Qt."
)
set(HAVE_QHELPGEN "NO")
message(STATUS "Unable to generate the API documentation in qch format. "
"To fix, install the qthelpgenerator program which comes with Qt."
)
endif()
find_file(
QDOC_QTCORE_TAG qtcore.tags
HINTS ${QT_INSTALL_DOCS}/qtcore
HINTS ${QT_INSTALL_DATA}/doc/qtcore)
find_file(QDOC_QTCORE_TAG qtcore.tags HINTS ${QT_INSTALL_DOCS}/qtcore ${QT_INSTALL_DATA}/doc/qtcore)
set(QDOC_TAG_DIR "<QDOC_TAG_DIR_not_found>")
if(QDOC_QTCORE_TAG)
get_filename_component(QDOC_TAG_DIR ${QDOC_QTCORE_TAG} DIRECTORY)
get_filename_component(QDOC_TAG_DIR ${QDOC_TAG_DIR} DIRECTORY)
get_filename_component(QDOC_TAG_DIR ${QDOC_QTCORE_TAG} DIRECTORY)
get_filename_component(QDOC_TAG_DIR ${QDOC_TAG_DIR} DIRECTORY)
endif()
file(GLOB _dox_deps *.dox *.html)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
# apidox generation using doxygen
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
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
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
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
${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND
${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/LICENSES/GPL-3.0-only.txt
${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND
${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/docs/KDDockWidgets-CopyrightAssignmentForm.pdf
${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples
${DOXYGEN_OUTPUT_DIR}/html/examples
DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_target(kddockwidgets-api.qch ALL
DEPENDS ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch)
add_custom_target(docs DEPENDS kddockwidgets-api.qch)
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
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
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
${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/GPL-3.0-only.txt
${DOXYGEN_OUTPUT_DIR}/html/LICENSES
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/docs/KDDockWidgets-CopyrightAssignmentForm.pdf
${DOXYGEN_OUTPUT_DIR}/html/docs
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples ${DOXYGEN_OUTPUT_DIR}/html/examples
DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generate the .qch file"
)
add_custom_target(
kddockwidgets-api.qch ALL
DEPENDS ${DOXYGEN_OUTPUT_DIR}/qch/kddockwidgets-api.qch
COMMENT "Target to generate the .qch file"
)
add_custom_target(
docs
DEPENDS kddockwidgets-api.qch
COMMENT "Target to generate the documentation"
)
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})
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})

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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -17,15 +17,13 @@ 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)
# 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(qtwidgets_dockwidgets main.cpp MyViewFactory.cpp MyMainWindow.cpp MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(qtwidgets_dockwidgets 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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -17,18 +17,16 @@ 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)
# 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)
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc)
# 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(qtwidgets_mdi main.cpp ../dockwidgets/MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(qtwidgets_mdi 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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -17,18 +17,16 @@ 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)
# 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)
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc)
# 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(qtwidgets_mdi_with_docking main.cpp ../dockwidgets/MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})
target_link_libraries(qtwidgets_mdi_with_docking 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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -17,13 +17,12 @@ 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)
# 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)
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc)
add_executable(qtwidgets_minimal main.cpp MyWidget.cpp ${RESOURCES_EXAMPLE_SRC})

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> Author: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -11,18 +11,15 @@
add_subdirectory(dockwidgets)
set_compiler_flags(qtquick_dockwidgets)
set_target_properties(
qtquick_dockwidgets PROPERTIES RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/")
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/")
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/")
qtquick_customtitlebar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)

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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -17,14 +17,14 @@ 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)
# 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)
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
add_executable(qtquick_customtitlebar main.cpp ${RESOURCES_EXAMPLE_SRC})

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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -17,14 +17,14 @@ 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)
# 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)
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
add_executable(qtquick_dockwidgets main.cpp ${RESOURCES_EXAMPLE_SRC})

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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -17,14 +17,14 @@ 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)
# 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_mdi_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc)
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_mdi_example.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
)
add_executable(qtquick_mdi main.cpp ${RESOURCES_EXAMPLE_SRC})

View File

@@ -1,9 +1,8 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group
# company <info@kdab.com> Author: Renato Araujo Oliveira Filho
# <renato.araujo@kdab.com>
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
@@ -13,20 +12,19 @@ set(PYTHON_BINDING_NAMESPACE "PyKDDockWidgets")
# Just to fix warnings with --warn-uninitialized
if(NOT DEFINED SHIBOKEN_CUSTOM_PREFIX) # look for shiboken in a custom location
set(SHIBOKEN_CUSTOM_PREFIX "")
set(SHIBOKEN_CUSTOM_PREFIX "")
endif()
if(NOT DEFINED PYSIDE_CUSTOM_PREFIX) # look for pyside in a custom location
set(PYSIDE_CUSTOM_PREFIX "")
set(PYSIDE_CUSTOM_PREFIX "")
endif()
if(${PROJECT_NAME}_QT6)
set(PYSIDE_MAJOR_VERSION "6")
set(PYTHON_BINDING_NAMESPACE
"${PYTHON_BINDING_NAMESPACE}Qt${PYSIDE_MAJOR_VERSION}")
set(QtWidgets_VERSION ${Qt6Widgets_VERSION})
set(PYSIDE_MAJOR_VERSION "6")
set(PYTHON_BINDING_NAMESPACE "${PYTHON_BINDING_NAMESPACE}Qt${PYSIDE_MAJOR_VERSION}")
set(QtWidgets_VERSION ${Qt6Widgets_VERSION})
else()
set(PYSIDE_MAJOR_VERSION "2")
set(QtWidgets_VERSION ${Qt5Widgets_VERSION})
set(PYSIDE_MAJOR_VERSION "2")
set(QtWidgets_VERSION ${Qt5Widgets_VERSION})
endif()
find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development)
@@ -34,16 +32,14 @@ find_package(Shiboken${PYSIDE_MAJOR_VERSION} REQUIRED)
find_package(PySide${PYSIDE_MAJOR_VERSION} ${QtWidgets_VERSION} EXACT REQUIRED)
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
set(BINDINGS_DIR
"${INSTALL_LIBRARY_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/${PYTHON_BINDING_NAMESPACE}"
)
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX
"${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${BINDINGS_DIR}")
set(Python3_VERSION_MAJORMIONR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(BINDINGS_DIR "${INSTALL_LIBRARY_DIR}/python${Python3_VERSION_MAJORMINOR}/site-packages/${PYTHON_BINDING_NAMESPACE}")
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${BINDINGS_DIR}")
include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
add_subdirectory(PyKDDockWidgets)
if(${PROJECT_NAME}_TESTS)
add_subdirectory(tests)
add_subdirectory(tests)
endif()

View File

@@ -1,9 +1,8 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group
# company <info@kdab.com> Author: Renato Araujo Oliveira Filho
# <renato.araujo@kdab.com>
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
@@ -27,7 +26,8 @@ set(PyKDDockWidgets_SRC
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_layoutsaver_wrapper.h
# global module wrapper
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_module_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_python.h)
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_python.h
)
# includes necessary to parse and build the classes specified on typesystem
set(PyKDDockWidgets_include_paths
@@ -37,48 +37,46 @@ set(PyKDDockWidgets_include_paths
# A list of paths where shiboken should look for typesystem
set(PyKDDockWidgets_typesystem_paths # PySide path, this variable was exposed by
# FindPySide2.cmake
${PYSIDE_TYPESYSTEMS})
${PYSIDE_TYPESYSTEMS}
)
# Include flags/path that will be set in 'target_include_directories'
set(PyKDDockWidgets_target_include_directories ${CMAKE_SOURCE_DIR}/src)
# Libraries that will be necessary to link the target, this will used in the
# command 'target_link_libraries'
set(PyKDDockWidgets_target_link_libraries
KDAB::kddockwidgets Qt${Qt_VERSION_MAJOR}::Core Qt${Qt_VERSION_MAJOR}::Gui
Qt${Qt_VERSION_MAJOR}::Widgets ${Python3_LIBRARIES})
set(PyKDDockWidgets_target_link_libraries KDAB::kddockwidgets Qt${Qt_VERSION_MAJOR}::Core Qt${Qt_VERSION_MAJOR}::Gui
Qt${Qt_VERSION_MAJOR}::Widgets ${Python3_LIBRARIES}
)
# changes on these files should trigger a new generation
set(PyKDDockWidgets_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h
${CMAKE_SOURCE_DIR}/src/DockWidget.h
${CMAKE_SOURCE_DIR}/src/DockWidget.h
${CMAKE_SOURCE_DIR}/src/MainWindow.h
${CMAKE_SOURCE_DIR}/src/MainWindow.h
${CMAKE_SOURCE_DIR}/src/LayoutSaver.h)
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h ${CMAKE_SOURCE_DIR}/src/DockWidget.h
${CMAKE_SOURCE_DIR}/src/DockWidget.h ${CMAKE_SOURCE_DIR}/src/MainWindow.h ${CMAKE_SOURCE_DIR}/src/MainWindow.h
${CMAKE_SOURCE_DIR}/src/LayoutSaver.h
)
create_python_bindings(
"KDDockWidgets"
"${PyKDDockWidgets_typesystem_paths}"
"${PyKDDockWidgets_include_paths}"
"${PyKDDockWidgets_SRC}"
"${PyKDDockWidgets_target_include_directories}"
"${PyKDDockWidgets_target_link_libraries}"
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h
${CMAKE_CURRENT_SOURCE_DIR}/typesystem_kddockwidgets.xml
"${PyKDDockWidgets_DEPENDS}"
${CMAKE_CURRENT_BINARY_DIR})
"KDDockWidgets"
"${PyKDDockWidgets_typesystem_paths}"
"${PyKDDockWidgets_include_paths}"
"${PyKDDockWidgets_SRC}"
"${PyKDDockWidgets_target_include_directories}"
"${PyKDDockWidgets_target_link_libraries}"
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h
${CMAKE_CURRENT_SOURCE_DIR}/typesystem_kddockwidgets.xml
"${PyKDDockWidgets_DEPENDS}"
${CMAKE_CURRENT_BINARY_DIR}
)
# Make module import from build dir work
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake
${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
# install
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py
$<TARGET_FILE:KDAB::kddockwidgets>
DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py $<TARGET_FILE:KDAB::kddockwidgets>
DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
)
if(NOT WIN32)
install(FILES $<TARGET_LINKER_FILE:KDAB::kddockwidgets>
$<TARGET_SONAME_FILE:KDAB::kddockwidgets>
DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
install(FILES $<TARGET_LINKER_FILE:KDAB::kddockwidgets> $<TARGET_SONAME_FILE:KDAB::kddockwidgets>
DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
)
endif()

View File

@@ -9,6 +9,8 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
from PyKDDockWidgetsQt6 import KDDockWidgets
from PySide6 import QtCore, QtWidgets, QtGui
@@ -17,33 +19,41 @@ from MyWidget1 import MyWidget1
from MyWidget2 import MyWidget2
from MyWidget3 import MyWidget3
def newMyWidget(parent = None):
def newMyWidget(parent=None):
randomNumber = QtCore.QRandomGenerator.global_().bounded(0, 100) + 1
if (randomNumber < 50):
if (randomNumber < 33):
if randomNumber < 50:
if randomNumber < 33:
return MyWidget1(parent)
else:
return MyWidget3(parent)
else:
return MyWidget2(parent)
return MyWidget3(parent)
return MyWidget2(parent)
class MyMainWindow(KDDockWidgets.MainWindow):
s_count = 0
s_menuCount = 0
def __init__(self, uniqueName, options = KDDockWidgets.MainWindowOption_None, dockWidget0IsNonClosable = False, nonDockableDockWidget9 = False, restoreIsRelative = False, maxSizeForDockWidget8 = False, affinityName = "", parent = None):
def __init__(self,
uniqueName,
options=KDDockWidgets.MainWindowOption_None,
dockWidget0IsNonClosable=False,
nonDockableDockWidget9=False,
restoreIsRelative=False,
maxSizeForDockWidget8=False,
affinityName="",
parent=None):
super().__init__(uniqueName, options, parent)
self.m_dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.m_dockWidget9IsNonDockable = nonDockableDockWidget9
self.m_restoreIsRelative = restoreIsRelative
self.m_maxSizeForDockWidget8 = maxSizeForDockWidget8
self.m_dockwidgets = []
self.dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.dockWidget9IsNonDockable = nonDockableDockWidget9
self.restoreIsRelative = restoreIsRelative
self.maxSizeForDockWidget8 = maxSizeForDockWidget8
self.dockwidgets = []
menubar = self.menuBar()
fileMenu = QtWidgets.QMenu("File")
self.m_toggleMenu = QtWidgets.QMenu("Toggle")
self.toggleMenu = QtWidgets.QMenu("Toggle")
menubar.addMenu(fileMenu)
menubar.addMenu(self.m_toggleMenu)
menubar.addMenu(self.toggleMenu)
newAction = fileMenu.addAction("New DockWidget")
newAction.triggered.connect(self._newDockWidget)
@@ -63,101 +73,104 @@ class MyMainWindow(KDDockWidgets.MainWindow):
quitAction = fileMenu.addAction("Quit")
quitAction.triggered.connect(QtWidgets.QApplication.instance().quit)
self.setAffinities([ affinityName ])
self.setAffinities([affinityName])
self.createDockWidgets()
def _newDockWidget(self):
MyMainWindow.s_menuCount += 1
w = newMyWidget(self)
w.setGeometry(100, 100, 400, 400)
dock = KDDockWidgets.DockWidget("new dock %d"%(MyMainWindow.s_menuCount))
dock = KDDockWidgets.DockWidget("new dock %d" % (MyMainWindow.s_menuCount))
dock.setWidget(w)
dock.resize(600, 600)
dock.show()
self.m_dockwidgets.append(dock)
self.dockwidgets.append(dock)
# pylint: disable=no-self-use
def _saveLayout(self):
#saver = KDDockWidgets.LayoutSaver()
#result = saver.saveToFile("mylayout.json")
#print("Saving layout to disk. Result=", result)
print("Not available")
# pylint: disable=no-self-use
def _restoreLayout(self):
#options = KDDockWidgets.RestoreOption_None
#if self.m_restoreIsRelative:
# if self.restoreIsRelative:
# options |= KDDockWidgets.RestoreOption_RelativeToMainWindow
#saver = KDDockWidgets.LayoutSaver(options)
#saver.restoreFromFile("mylayout.json")
# saver.restoreFromFile("mylayout.json")
print("Not available")
def _closeAll(self):
for dw in self.m_dockwidgets:
dw.close()
for widget in self.dockwidgets:
widget.close()
def createDockWidgets(self):
if self.m_dockWidget9IsNonDockable:
if self.dockWidget9IsNonDockable:
numDockWidgets = 10
else:
numDockWidgets = 9
# numDockWidgets = 2
# Create 9 KDDockWidget::DockWidget and the respective widgets they're hosting (MyWidget instances)
for i in range(numDockWidgets):
self.m_dockwidgets.append(self.newDockWidget())
for _ in range(numDockWidgets):
self.dockwidgets.append(self.newDockWidget())
# MainWindow::addDockWidget() attaches a dock widget to the main window:
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden, QtCore.QSize(500, 500))
self.addDockWidget(self.m_dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden,
QtCore.QSize(500, 500))
self.addDockWidget(self.dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
# Here, for finer granularity we specify right of dockwidgets[0]:
self.addDockWidget(self.m_dockwidgets[1], KDDockWidgets.Location_OnRight, self.m_dockwidgets[0])
self.addDockWidget(self.m_dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.m_dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.m_dockwidgets[4], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[1], KDDockWidgets.Location_OnRight, self.dockwidgets[0])
self.addDockWidget(self.dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[4], KDDockWidgets.Location_OnBottom)
# Tab two dock widgets together
self.m_dockwidgets[3].addDockWidgetAsTab(self.m_dockwidgets[5])
self.dockwidgets[3].addDockWidgetAsTab(self.dockwidgets[5])
# 6 is floating, as it wasn't added to the main window via MainWindow::addDockWidget().
# and we tab 7 with it.
self.m_dockwidgets[6].addDockWidgetAsTab(self.m_dockwidgets[7])
self.dockwidgets[6].addDockWidgetAsTab(self.dockwidgets[7])
# Floating windows also support nesting, here we add 8 to the bottom of the group
self.m_dockwidgets[6].addDockWidgetToContainingWindow(self.m_dockwidgets[8], KDDockWidgets.Location_OnBottom)
self.dockwidgets[6].addDockWidgetToContainingWindow(self.dockwidgets[8], KDDockWidgets.Location_OnBottom)
floatingWindow = self.m_dockwidgets[6].window()
floatingWindow = self.dockwidgets[6].window()
floatingWindow.move(100, 100)
def newDockWidget(self):
# Passing options is optional, we just want to illustrate Option_NotClosable here
options = KDDockWidgets.DockWidget.Option_None
if (MyMainWindow.s_count == 0) and self.m_dockWidget0IsNonClosable:
if (MyMainWindow.s_count == 0) and self.dockWidget0IsNonClosable:
options |= KDDockWidgets.DockWidget.Option_NotClosable
if (MyMainWindow.s_count == 9) and self.m_dockWidget9IsNonDockable:
if (MyMainWindow.s_count == 9) and self.dockWidget9IsNonDockable:
options |= KDDockWidgets.DockWidget.Option_NotDockable
dock = KDDockWidgets.DockWidget("DockWidget #%d"%(MyMainWindow.s_count), options)
dock.setAffinities(self.affinities()); # optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock = KDDockWidgets.DockWidget("DockWidget #%d" % (MyMainWindow.s_count), options)
# optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock.setAffinities(self.affinities())
if MyMainWindow.s_count == 1:
dock.setIcon(QtGui.QIcon.fromTheme("mail-message"))
myWidget = newMyWidget(self)
if (MyMainWindow.s_count == 8) and self.m_maxSizeForDockWidget8:
if (MyMainWindow.s_count == 8) and self.maxSizeForDockWidget8:
# Set a maximum size on dock #8
myWidget.setMaximumSize(200, 200)
dock.setWidget(myWidget)
if dock.options() & KDDockWidgets.DockWidget.Option_NotDockable:
dock.setTitle("DockWidget #%d (%s)" %(MyMainWindow.s_count, "non dockable"))
dock.setTitle("DockWidget #%d (%s)" % (MyMainWindow.s_count, "non dockable"))
else:
dock.setTitle("DockWidget #%d"%(MyMainWindow.s_count))
dock.setTitle("DockWidget #%d" % (MyMainWindow.s_count))
dock.resize(600, 600)
self.m_toggleMenu.addAction(dock.toggleAction())
self.toggleMenu.addAction(dock.toggleAction())
MyMainWindow.s_count += 1
return dock

View File

@@ -9,18 +9,23 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtWidgets, QtGui, QtCore
# pylint: disable=too-few-public-methods
class MyWidget(QtWidgets.QWidget):
s_images = {}
def __init__(self, backgroundFile, logoFile, parent = None):
def __init__(self, backgroundFile, logoFile, parent=None):
super().__init__(parent)
self.m_background = self._lookupImage(backgroundFile)
self.m_logo = self._lookupImage(logoFile)
self.background = self._lookupImage(backgroundFile)
self.logo = self._lookupImage(logoFile)
# pylint: disable=no-self-use
def _lookupImage(self, imageName):
if imageName == "":
return None
@@ -29,23 +34,23 @@ class MyWidget(QtWidgets.QWidget):
MyWidget.s_images[imageName] = QtGui.QImage(imageName)
return MyWidget.s_images[imageName]
def drawLogo(self, p):
if not self.m_logo:
if not self.logo:
return
ratio = self.m_logo.height() / (self.m_logo.width() * 1.0)
ratio = self.logo.height() / (self.logo.width() * 1.0)
maxWidth = int(0.80 * self.size().width())
maxHeight = int(0.80 * self.size().height())
proposedHeight = int(maxWidth * ratio)
if (proposedHeight <= maxHeight):
if proposedHeight <= maxHeight:
width = maxWidth
else:
width = int(maxHeight / ratio)
height = int(width * ratio)
targetLogoRect = QtCore.QRect(0,0, width, height)
targetLogoRect.moveCenter(self.rect().center() + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.m_logo, self.m_logo.rect());
targetLogoRect = QtCore.QRect(0, 0, width, height)
targetLogoRect.moveCenter(self.rect().center(
) + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.logo, self.logo.rect())

View File

@@ -9,21 +9,20 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
from PySide6 import QtWidgets, QtGui
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtGui
from MyWidget import MyWidget
class MyWidget1(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/triangles.png", ":/assets/KDAB_bubble_white.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xCC, 0xCC, 0xCC))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
self.drawLogo(p)

View File

@@ -9,19 +9,19 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtWidgets, QtGui, QtCore
from PySide6 import QtGui, QtCore
from MyWidget import MyWidget
class MyWidget2(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__("", ":/assets/KDAB_bubble_blue.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtCore.Qt.white);
p.fillRect(self.rect(), QtCore.Qt.white)
self.drawLogo(p)

View File

@@ -9,24 +9,27 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgetsQt6
from PySide6 import QtWidgets, QtGui, QtCore
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide6 import QtGui, QtCore
from MyWidget import MyWidget
class MyWidget3(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/base.png", ":/assets/KDAB_bubble_fulcolor.png", parent)
self.m_triangle = QtGui.QImage(":/assets/tri.png")
self.triangle = QtGui.QImage(":/assets/tri.png")
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xD5, 0xD5, 0xD5))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
targetRect = QtCore.QRect(QtCore.QPoint(self.width() - self.m_triangle.width(), self.height() - self.m_triangle.height()), self.m_triangle.size())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
QtCore.QRect(QtCore.QPoint(self.width() - self.triangle.width(),
self.height() - self.triangle.height()),
self.triangle.size())
self.drawLogo(p)

View File

@@ -3,6 +3,9 @@ Running python example
Generate resource file with:
~# rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(on some systems, rcc might be invoked as rcc-qt6)
Make sure you installed kddockwidgets and set PYTHONPATH accordingly.
Run the app:
~# python3 main.py

View File

@@ -9,16 +9,26 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
from PyKDDockWidgetsQt6 import KDDockWidgets
from MyMainWindow import MyMainWindow
from PySide6 import QtWidgets, QtCore
''' KDDockWidgets example (Qt6) '''
import sys
from MyMainWindow import MyMainWindow
from PySide6 import QtWidgets, QtCore
try:
# pylint: disable=unused-import
import rc_assets
except:
exit("Oops.. rc_assets needs to be generated first.\nPlease run:\n rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc\n(Make sure to use the rcc from the Qt6 version used to generate the bindings!)")
except ImportError:
sys.exit(
'''
Oops.. rc_assets needs to be generated first.
Please run:
rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(Make sure to use the rcc from the Qt6 version used to generate the bindings!)
On some systems rcc might be invoked as rcc-qt6.
'''
)
if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
@@ -34,5 +44,4 @@ if __name__ == "__main__":
mainWindow.resize(1200, 1200)
mainWindow.show()
app.exec_()
app.exec()

View File

@@ -9,6 +9,8 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
from PyKDDockWidgets import KDDockWidgets
from PySide2 import QtCore, QtWidgets, QtGui
@@ -17,33 +19,41 @@ from MyWidget1 import MyWidget1
from MyWidget2 import MyWidget2
from MyWidget3 import MyWidget3
def newMyWidget(parent = None):
def newMyWidget(parent=None):
randomNumber = QtCore.QRandomGenerator.global_().bounded(0, 100) + 1
if (randomNumber < 50):
if (randomNumber < 33):
if randomNumber < 50:
if randomNumber < 33:
return MyWidget1(parent)
else:
return MyWidget3(parent)
else:
return MyWidget2(parent)
return MyWidget3(parent)
return MyWidget2(parent)
class MyMainWindow(KDDockWidgets.MainWindow):
s_count = 0
s_menuCount = 0
def __init__(self, uniqueName, options = KDDockWidgets.MainWindowOption_None, dockWidget0IsNonClosable = False, nonDockableDockWidget9 = False, restoreIsRelative = False, maxSizeForDockWidget8 = False, affinityName = "", parent = None):
def __init__(self,
uniqueName,
options=KDDockWidgets.MainWindowOption_None,
dockWidget0IsNonClosable=False,
nonDockableDockWidget9=False,
restoreIsRelative=False,
maxSizeForDockWidget8=False,
affinityName="",
parent=None):
super().__init__(uniqueName, options, parent)
self.m_dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.m_dockWidget9IsNonDockable = nonDockableDockWidget9
self.m_restoreIsRelative = restoreIsRelative
self.m_maxSizeForDockWidget8 = maxSizeForDockWidget8
self.m_dockwidgets = []
self.dockWidget0IsNonClosable = dockWidget0IsNonClosable
self.dockWidget9IsNonDockable = nonDockableDockWidget9
self.restoreIsRelative = restoreIsRelative
self.maxSizeForDockWidget8 = maxSizeForDockWidget8
self.dockwidgets = []
menubar = self.menuBar()
fileMenu = QtWidgets.QMenu("File")
self.m_toggleMenu = QtWidgets.QMenu("Toggle")
self.toggleMenu = QtWidgets.QMenu("Toggle")
menubar.addMenu(fileMenu)
menubar.addMenu(self.m_toggleMenu)
menubar.addMenu(self.toggleMenu)
newAction = fileMenu.addAction("New DockWidget")
newAction.triggered.connect(self._newDockWidget)
@@ -63,101 +73,104 @@ class MyMainWindow(KDDockWidgets.MainWindow):
quitAction = fileMenu.addAction("Quit")
quitAction.triggered.connect(QtWidgets.QApplication.instance().quit)
self.setAffinities([ affinityName ])
self.setAffinities([affinityName])
self.createDockWidgets()
def _newDockWidget(self):
MyMainWindow.s_menuCount += 1
w = newMyWidget(self)
w.setGeometry(100, 100, 400, 400)
dock = KDDockWidgets.DockWidget("new dock %d"%(MyMainWindow.s_menuCount))
dock = KDDockWidgets.DockWidget("new dock %d" % (MyMainWindow.s_menuCount))
dock.setWidget(w)
dock.resize(600, 600)
dock.show()
self.m_dockwidgets.append(dock)
self.dockwidgets.append(dock)
# pylint: disable=no-self-use
def _saveLayout(self):
#saver = KDDockWidgets.LayoutSaver()
#result = saver.saveToFile("mylayout.json")
#print("Saving layout to disk. Result=", result)
print("Not available")
# pylint: disable=no-self-use
def _restoreLayout(self):
#options = KDDockWidgets.RestoreOption_None
#if self.m_restoreIsRelative:
# if self.restoreIsRelative:
# options |= KDDockWidgets.RestoreOption_RelativeToMainWindow
#saver = KDDockWidgets.LayoutSaver(options)
#saver.restoreFromFile("mylayout.json")
# saver.restoreFromFile("mylayout.json")
print("Not available")
def _closeAll(self):
for dw in self.m_dockwidgets:
dw.close()
for widget in self.dockwidgets:
widget.close()
def createDockWidgets(self):
if self.m_dockWidget9IsNonDockable:
if self.dockWidget9IsNonDockable:
numDockWidgets = 10
else:
numDockWidgets = 9
# numDockWidgets = 2
# Create 9 KDDockWidget::DockWidget and the respective widgets they're hosting (MyWidget instances)
for i in range(numDockWidgets):
self.m_dockwidgets.append(self.newDockWidget())
for _ in range(numDockWidgets):
self.dockwidgets.append(self.newDockWidget())
# MainWindow::addDockWidget() attaches a dock widget to the main window:
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden, QtCore.QSize(500, 500))
self.addDockWidget(self.m_dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
initialOpts = KDDockWidgets.InitialOption(KDDockWidgets.InitialVisibilityOption.StartHidden,
QtCore.QSize(500, 500))
self.addDockWidget(self.dockwidgets[0], KDDockWidgets.Location_OnBottom, None, initialOpts)
# Here, for finer granularity we specify right of dockwidgets[0]:
self.addDockWidget(self.m_dockwidgets[1], KDDockWidgets.Location_OnRight, self.m_dockwidgets[0])
self.addDockWidget(self.m_dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.m_dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.m_dockwidgets[4], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[1], KDDockWidgets.Location_OnRight, self.dockwidgets[0])
self.addDockWidget(self.dockwidgets[2], KDDockWidgets.Location_OnLeft)
self.addDockWidget(self.dockwidgets[3], KDDockWidgets.Location_OnBottom)
self.addDockWidget(self.dockwidgets[4], KDDockWidgets.Location_OnBottom)
# Tab two dock widgets together
self.m_dockwidgets[3].addDockWidgetAsTab(self.m_dockwidgets[5])
self.dockwidgets[3].addDockWidgetAsTab(self.dockwidgets[5])
# 6 is floating, as it wasn't added to the main window via MainWindow::addDockWidget().
# and we tab 7 with it.
self.m_dockwidgets[6].addDockWidgetAsTab(self.m_dockwidgets[7])
self.dockwidgets[6].addDockWidgetAsTab(self.dockwidgets[7])
# Floating windows also support nesting, here we add 8 to the bottom of the group
self.m_dockwidgets[6].addDockWidgetToContainingWindow(self.m_dockwidgets[8], KDDockWidgets.Location_OnBottom)
self.dockwidgets[6].addDockWidgetToContainingWindow(self.dockwidgets[8], KDDockWidgets.Location_OnBottom)
floatingWindow = self.m_dockwidgets[6].window()
floatingWindow = self.dockwidgets[6].window()
floatingWindow.move(100, 100)
def newDockWidget(self):
# Passing options is optional, we just want to illustrate Option_NotClosable here
options = KDDockWidgets.DockWidget.Option_None
if (MyMainWindow.s_count == 0) and self.m_dockWidget0IsNonClosable:
if (MyMainWindow.s_count == 0) and self.dockWidget0IsNonClosable:
options |= KDDockWidgets.DockWidget.Option_NotClosable
if (MyMainWindow.s_count == 9) and self.m_dockWidget9IsNonDockable:
if (MyMainWindow.s_count == 9) and self.dockWidget9IsNonDockable:
options |= KDDockWidgets.DockWidget.Option_NotDockable
dock = KDDockWidgets.DockWidget("DockWidget #%d"%(MyMainWindow.s_count), options)
dock.setAffinities(self.affinities()); # optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock = KDDockWidgets.DockWidget("DockWidget #%d" % (MyMainWindow.s_count), options)
# optional, just to show the feature. Pass -mi to the example to see incompatible dock widgets
dock.setAffinities(self.affinities())
if MyMainWindow.s_count == 1:
dock.setIcon(QtGui.QIcon.fromTheme("mail-message"))
myWidget = newMyWidget(self)
if (MyMainWindow.s_count == 8) and self.m_maxSizeForDockWidget8:
if (MyMainWindow.s_count == 8) and self.maxSizeForDockWidget8:
# Set a maximum size on dock #8
myWidget.setMaximumSize(200, 200)
dock.setWidget(myWidget)
if dock.options() & KDDockWidgets.DockWidget.Option_NotDockable:
dock.setTitle("DockWidget #%d (%s)" %(MyMainWindow.s_count, "non dockable"))
dock.setTitle("DockWidget #%d (%s)" % (MyMainWindow.s_count, "non dockable"))
else:
dock.setTitle("DockWidget #%d"%(MyMainWindow.s_count))
dock.setTitle("DockWidget #%d" % (MyMainWindow.s_count))
dock.resize(600, 600)
self.m_toggleMenu.addAction(dock.toggleAction())
self.toggleMenu.addAction(dock.toggleAction())
MyMainWindow.s_count += 1
return dock

View File

@@ -9,18 +9,23 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtWidgets, QtGui, QtCore
# pylint: disable=too-few-public-methods
class MyWidget(QtWidgets.QWidget):
s_images = {}
def __init__(self, backgroundFile, logoFile, parent = None):
def __init__(self, backgroundFile, logoFile, parent=None):
super().__init__(parent)
self.m_background = self._lookupImage(backgroundFile)
self.m_logo = self._lookupImage(logoFile)
self.background = self._lookupImage(backgroundFile)
self.logo = self._lookupImage(logoFile)
# pylint: disable=no-self-use
def _lookupImage(self, imageName):
if imageName == "":
return None
@@ -29,23 +34,23 @@ class MyWidget(QtWidgets.QWidget):
MyWidget.s_images[imageName] = QtGui.QImage(imageName)
return MyWidget.s_images[imageName]
def drawLogo(self, p):
if not self.m_logo:
if not self.logo:
return
ratio = self.m_logo.height() / (self.m_logo.width() * 1.0)
ratio = self.logo.height() / (self.logo.width() * 1.0)
maxWidth = int(0.80 * self.size().width())
maxHeight = int(0.80 * self.size().height())
proposedHeight = int(maxWidth * ratio)
if (proposedHeight <= maxHeight):
if proposedHeight <= maxHeight:
width = maxWidth
else:
width = int(maxHeight / ratio)
height = int(width * ratio)
targetLogoRect = QtCore.QRect(0,0, width, height)
targetLogoRect.moveCenter(self.rect().center() + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.m_logo, self.m_logo.rect());
targetLogoRect = QtCore.QRect(0, 0, width, height)
targetLogoRect.moveCenter(self.rect().center(
) + QtCore.QPoint(0, -int(self.size().height() * 0.00)))
p.drawImage(targetLogoRect, self.logo, self.logo.rect())

View File

@@ -9,21 +9,20 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
from PySide2 import QtWidgets, QtGui
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtGui
from MyWidget import MyWidget
class MyWidget1(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/triangles.png", ":/assets/KDAB_bubble_white.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xCC, 0xCC, 0xCC))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
self.drawLogo(p)

View File

@@ -9,19 +9,19 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtWidgets, QtGui, QtCore
from PySide2 import QtGui, QtCore
from MyWidget import MyWidget
class MyWidget2(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__("", ":/assets/KDAB_bubble_blue.png", parent)
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtCore.Qt.white);
p.fillRect(self.rect(), QtCore.Qt.white)
self.drawLogo(p)

View File

@@ -9,24 +9,27 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import PyKDDockWidgets
from PySide2 import QtWidgets, QtGui, QtCore
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from PySide2 import QtGui, QtCore
from MyWidget import MyWidget
class MyWidget3(MyWidget):
def __init__(self, parent = None):
def __init__(self, parent=None):
super().__init__(":/assets/base.png", ":/assets/KDAB_bubble_fulcolor.png", parent)
self.m_triangle = QtGui.QImage(":/assets/tri.png")
self.triangle = QtGui.QImage(":/assets/tri.png")
def paintEvent(self, ev):
def paintEvent(self, event):
del event # unused at this time
p = QtGui.QPainter(self)
p.fillRect(self.rect(), QtGui.QColor(0xD5, 0xD5, 0xD5))
p.drawImage(self.m_background.rect(), self.m_background, self.m_background.rect())
targetRect = QtCore.QRect(QtCore.QPoint(self.width() - self.m_triangle.width(), self.height() - self.m_triangle.height()), self.m_triangle.size())
p.drawImage(self.background.rect(),
self.background, self.background.rect())
QtCore.QRect(QtCore.QPoint(self.width() - self.triangle.width(),
self.height() - self.triangle.height()),
self.triangle.size())
self.drawLogo(p)

View File

@@ -3,6 +3,9 @@ Running python example
Generate resource file with:
~# rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(on some systems, rcc might be invoked as rcc-qt5)
Make sure you installed kddockwidgets and set PYTHONPATH accordingly.
Run the app:
~# python3 main.py

View File

@@ -9,16 +9,26 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
from PyKDDockWidgets import KDDockWidgets
from MyMainWindow import MyMainWindow
from PySide2 import QtWidgets, QtCore
''' KDDockWidgets example (Qt5) '''
import sys
from MyMainWindow import MyMainWindow
from PySide2 import QtWidgets, QtCore
try:
# pylint: disable=unused-import
import rc_assets
except:
exit("Oops.. rc_assets needs to be generated first.\nPlease run:\n rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc\n(Make sure to use the rcc from the Qt5 version used to generate the bindings!)")
except ImportError:
sys.exit(
'''
Oops.. rc_assets needs to be generated first.
Please run:
rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc
(Make sure to use the rcc from the Qt5 version used to generate the bindings!)
On some systems rcc might be invoked as rcc-qt5.
'''
)
if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
@@ -35,4 +45,3 @@ if __name__ == "__main__":
mainWindow.show()
app.exec_()

View File

@@ -1,40 +1,36 @@
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group
# company <info@kdab.com> Author: Renato Araujo Oliveira Filho
# <renato.araujo@kdab.com>
# SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.cmake
${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)
set(TEST_PYTHONPATH ${CMAKE_BINARY_DIR}/python ${CMAKE_CURRENT_BINARY_DIR})
set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
if(WIN32)
set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
else()
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
endif()
set(PYTHON_ENV_COMMON
"PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py)
foreach(test_file ${TEST_FILES})
get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT
"${PYTHON_ENV_COMMON}")
get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
endforeach()

View File

@@ -8,12 +8,15 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
import unittest
import importlib
import inspect
from config import TstConfig
class TestImportModules(unittest.TestCase):
def test_importModules(self):
m = importlib.import_module(TstConfig.bindingsNamespace + '.KDDockWidgets')
@@ -25,6 +28,7 @@ class TestImportModules(unittest.TestCase):
for symbol in symbols:
self.assertIn(symbol, moduleSymbols)
if __name__ == '__main__':
TstConfig.initLibraryPath()
unittest.main()

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> Author: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -9,13 +9,13 @@
#
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW)
cmake_policy(SET CMP0043 NEW)
endif()
add_definitions(
-DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_STRICT_ITERATORS
-DQT_NO_KEYWORDS -DQT_NO_FOREACH)
-DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_STRICT_ITERATORS -DQT_NO_KEYWORDS -DQT_NO_FOREACH
)
set(KDDW_BACKEND_SRCS
KDDockWidgets.cpp
@@ -106,7 +106,8 @@ set(KDDW_BACKEND_SRCS
qtcommon/Platform_qt.cpp
qtcommon/Window_qt.cpp
qtcommon/View_qt.cpp
kddockwidgets_resources.qrc)
kddockwidgets_resources.qrc
)
set(KDDW_FRONTEND_QTWIDGETS_SRCS
qtwidgets/Window_qtwidgets.cpp
@@ -149,7 +150,8 @@ set(KDDW_FRONTEND_QTWIDGETS_SRCS
qtwidgets/DebugWindow.cpp
qtwidgets/DebugWindow.h
qtwidgets/ObjectViewer.cpp
qtwidgets/ObjectViewer.h)
qtwidgets/ObjectViewer.h
)
set(KDDW_FRONTEND_QTQUICK_SRCS
qtquick/Window_qtquick.cpp
@@ -196,19 +198,18 @@ set(KDDW_FRONTEND_QTQUICK_SRCS
qtquick/views/ViewWrapper_qtquick.h
qtquick/views/ClassicIndicatorsWindow_qtquick.cpp
qtquick/views/ClassicIndicatorsWindow_qtquick.h
qtquick/kddockwidgets_qtquick.qrc)
qtquick/kddockwidgets_qtquick.qrc
)
if(KDDockWidgets_DEVELOPER_MODE)
set(KDDW_FRONTEND_QTQUICK_SRCS ${KDDW_FRONTEND_QTQUICK_SRCS}
qtquick/TestHelpers_qtquick.cpp)
set(KDDW_FRONTEND_QTQUICK_SRCS ${KDDW_FRONTEND_QTQUICK_SRCS} qtquick/TestHelpers_qtquick.cpp)
set(KDDW_FRONTEND_QTWIDGETS_SRCS ${KDDW_FRONTEND_QTWIDGETS_SRCS}
qtwidgets/TestHelpers_qtwidgets.cpp)
set(KDDW_FRONTEND_QTWIDGETS_SRCS ${KDDW_FRONTEND_QTWIDGETS_SRCS} qtwidgets/TestHelpers_qtwidgets.cpp)
endif()
set(KDDW_FRONTEND_DUMMY_SRCS
dummy/ViewFactory_dummy.cpp dummy/Platform_dummy.cpp dummy/Window_dummy.cpp
dummy/views/View_dummy.cpp dummy/TestHelpers_dummy.cpp)
set(KDDW_FRONTEND_DUMMY_SRCS dummy/ViewFactory_dummy.cpp dummy/Platform_dummy.cpp dummy/Window_dummy.cpp
dummy/views/View_dummy.cpp dummy/TestHelpers_dummy.cpp
)
set(KDDW_PUBLIC_HEADERS
docks_export.h
@@ -222,12 +223,12 @@ set(KDDW_PUBLIC_HEADERS
Window.h
ViewFactory.h
Qt5Qt6Compat_p.h
Platform.h)
Platform.h
)
set(KDDW_PRIVATE_HEADERS
private/DragController_p.h private/Draggable_p.h private/LayoutSaver_p.h
private/WindowBeingDragged_p.h private/WidgetResizeHandler_p.h
DockRegistry.h # No ABI guarantees for now, so copy to private/
private/DragController_p.h private/Draggable_p.h private/LayoutSaver_p.h private/WindowBeingDragged_p.h
private/WidgetResizeHandler_p.h DockRegistry.h # No ABI guarantees for now, so copy to private/
)
set(KDDW_CONTROLLER_HEADERS
@@ -244,7 +245,8 @@ set(KDDW_CONTROLLER_HEADERS
controllers/MainWindow.h
controllers/Separator.h
controllers/Stack.h
controllers/TitleBar.h)
controllers/TitleBar.h
)
set(KDDW_VIEWINTERFACE_HEADERS
views/StackViewInterface.h
@@ -255,115 +257,107 @@ set(KDDW_VIEWINTERFACE_HEADERS
views/DockWidgetViewInterface.h
views/MainWindowMDIViewInterface.h
views/MainWindowViewInterface.h
views/GroupViewInterface.h)
views/GroupViewInterface.h
)
set(KDDW_INDICATOR_HEADERS
controllers/indicators/NullIndicators.h
controllers/indicators/ClassicIndicators.h
controllers/indicators/SegmentedIndicators.h)
set(KDDW_INDICATOR_HEADERS controllers/indicators/NullIndicators.h controllers/indicators/ClassicIndicators.h
controllers/indicators/SegmentedIndicators.h
)
set(DOCKSLIBS_SRCS ${KDDW_BACKEND_SRCS})
if(KDDW_FRONTEND_QTWIDGETS)
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} ${KDDW_FRONTEND_QTWIDGETS_SRCS})
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} ${KDDW_FRONTEND_QTWIDGETS_SRCS})
endif()
if(KDDW_FRONTEND_QTQUICK)
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} ${KDDW_FRONTEND_QTQUICK_SRCS})
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} ${KDDW_FRONTEND_QTQUICK_SRCS})
endif()
if(KDDW_FRONTEND_DUMMY)
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} ${KDDW_FRONTEND_DUMMY_SRCS})
set(DOCKSLIBS_SRCS ${DOCKSLIBS_SRCS} ${KDDW_FRONTEND_DUMMY_SRCS})
endif()
# Generate C/C++ CamelCase forwarding headers (only public includes)
include(ECMGenerateHeaders)
ecm_generate_headers(
camelcase_HEADERS
ORIGINAL
CAMELCASE
HEADER_NAMES
Config
# DockWidget DockWidgetBase
FocusScope
ViewFactory,
# DefaultWidgetFactory
LayoutSaver
# MainWindow MainWindowBase MainWindowMDI
camelcase_HEADERS
ORIGINAL
CAMELCASE
HEADER_NAMES
Config
# DockWidget DockWidgetBase
FocusScope
ViewFactory,
# DefaultWidgetFactory
LayoutSaver
# MainWindow MainWindowBase MainWindowMDI
)
add_library(kddockwidgets ${KDDockWidgets_LIBRARY_MODE} ${DOCKSLIBS_SRCS}
${KDDW_PUBLIC_HEADERS})
add_library(kddockwidgets ${KDDockWidgets_LIBRARY_MODE} ${DOCKSLIBS_SRCS} ${KDDW_PUBLIC_HEADERS})
add_library(KDAB::kddockwidgets ALIAS kddockwidgets)
set_target_properties(
kddockwidgets PROPERTIES OUTPUT_NAME
"kddockwidgets${KDDockWidgets_LIBRARY_QTID}")
set_target_properties(kddockwidgets PROPERTIES OUTPUT_NAME "kddockwidgets${KDDockWidgets_LIBRARY_QTID}")
set_compiler_flags(kddockwidgets)
if(KDDockWidgets_QT6)
set(DOCKS_INCLUDES_INSTALL_PATH "include/kddockwidgets-qt6")
set(DOCKS_INCLUDES_INSTALL_PATH "include/kddockwidgets-qt6")
else()
set(DOCKS_INCLUDES_INSTALL_PATH "include/")
set(DOCKS_INCLUDES_INSTALL_PATH "include/")
endif()
# Use a separate target for our kdbindings/signal.h header as it doesn't compile
# with -Wweak-vtables
add_library(kdbindings INTERFACE)
target_include_directories(
kdbindings SYSTEM
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty>)
target_include_directories(kdbindings SYSTEM INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty>)
target_include_directories(
kddockwidgets
PUBLIC $<INSTALL_INTERFACE:${DOCKS_INCLUDES_INSTALL_PATH}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
kddockwidgets
PUBLIC $<INSTALL_INTERFACE:${DOCKS_INCLUDES_INSTALL_PATH}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)
if(KDDW_FRONTEND_QTWIDGETS)
target_include_directories(
kddockwidgets
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers/qtwidgets>)
if(KDockWidgets_PRETTY_QTWIDGETS_HEADERS)
target_include_directories(
kddockwidgets
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers/qtwidgets_pretty>
kddockwidgets PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers/qtwidgets>
)
endif()
if(KDockWidgets_PRETTY_QTWIDGETS_HEADERS)
target_include_directories(
kddockwidgets PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers/qtwidgets_pretty>
)
endif()
endif()
if(KDDW_FRONTEND_QTQUICK)
target_include_directories(
kddockwidgets
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers/qtquick>)
target_include_directories(kddockwidgets PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fwd_headers/qtquick>)
endif()
target_compile_definitions(
kddockwidgets PRIVATE QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
QT_NO_URL_CAST_FROM_STRING QT_NO_CAST_FROM_BYTEARRAY)
kddockwidgets PRIVATE QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII QT_NO_URL_CAST_FROM_STRING
QT_NO_CAST_FROM_BYTEARRAY
)
if(KDDockWidgets_STATIC)
target_compile_definitions(kddockwidgets PUBLIC KDDOCKWIDGETS_STATICLIB)
target_compile_definitions(kddockwidgets PUBLIC KDDOCKWIDGETS_STATICLIB)
else()
target_compile_definitions(kddockwidgets PRIVATE BUILDING_DOCKS_LIBRARY)
target_compile_definitions(kddockwidgets PRIVATE BUILDING_DOCKS_LIBRARY)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD)
target_compile_options(kddockwidgets PRIVATE -Wshadow)
if(NOT MSVC)
target_compile_options(kddockwidgets PRIVATE -fvisibility=hidden)
endif()
target_compile_options(kddockwidgets PRIVATE -Wshadow)
if(NOT MSVC)
target_compile_options(kddockwidgets PRIVATE -fvisibility=hidden)
endif()
# Disable -Wconversion for Qt6. The qsizetype to int conversions are harmless
if(NOT KDDockWidgets_QT6)
target_compile_options(kddockwidgets PRIVATE -Wconversion)
endif()
# Disable -Wconversion for Qt6. The qsizetype to int conversions are harmless
if(NOT KDDockWidgets_QT6)
target_compile_options(kddockwidgets PRIVATE -Wconversion)
endif()
if(IS_CLANG_BUILD)
target_compile_options(kddockwidgets PRIVATE -Wweak-vtables)
endif()
if(IS_CLANG_BUILD)
target_compile_options(kddockwidgets PRIVATE -Wweak-vtables)
endif()
endif()
# BEGIN coverage
@@ -371,249 +365,230 @@ add_library(coverage_options INTERFACE)
if(KDDockWidgets_CODE_COVERAGE
AND (CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD)
AND NOT MSVC)
if(KDDockWidgets_DEVELOPER_MODE)
# Add required flags (GCC & LLVM/Clang)
target_compile_options(coverage_options INTERFACE --coverage)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(coverage_options INTERFACE --coverage)
else()
target_link_libraries(coverage_options INTERFACE --coverage)
AND NOT MSVC
)
if(KDDockWidgets_DEVELOPER_MODE)
# Add required flags (GCC & LLVM/Clang)
target_compile_options(coverage_options INTERFACE --coverage)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(coverage_options INTERFACE --coverage)
else()
target_link_libraries(coverage_options INTERFACE --coverage)
endif()
endif()
endif()
endif()
# END coverage
if(KDDW_FRONTEND_QTWIDGETS)
target_link_libraries(
kddockwidgets
PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets
PRIVATE Qt${Qt_VERSION_MAJOR}::WidgetsPrivate)
target_link_libraries(
kddockwidgets
PUBLIC Qt${Qt_VERSION_MAJOR}::Widgets
PRIVATE Qt${Qt_VERSION_MAJOR}::WidgetsPrivate
)
endif()
if(KDDW_FRONTEND_QTQUICK)
target_link_libraries(
kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Quick
Qt${Qt_VERSION_MAJOR}::QuickControls2)
target_link_libraries(kddockwidgets PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Quick Qt${Qt_VERSION_MAJOR}::QuickControls2)
target_link_libraries(kddockwidgets PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate)
endif()
if(KDDockWidgets_CODE_COVERAGE)
target_link_libraries(kddockwidgets PUBLIC coverage_options)
target_link_libraries(kddockwidgets PUBLIC coverage_options)
endif()
if(KDDockWidgets_DEVELOPER_MODE)
find_package(Qt${Qt_VERSION_MAJOR}Test ${QT_MIN_VERSION} REQUIRED)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Test)
find_package(Qt${Qt_VERSION_MAJOR}Test ${QT_MIN_VERSION} REQUIRED)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::Test)
endif()
target_link_libraries(kddockwidgets PRIVATE kdbindings)
if(WIN32)
target_link_libraries(kddockwidgets PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate
dwmapi)
target_link_libraries(kddockwidgets PRIVATE Qt${Qt_VERSION_MAJOR}::GuiPrivate dwmapi)
elseif(
NOT APPLE
AND NOT EMSCRIPTEN
AND NOT KDDockWidgets_QT6
AND KDDockWidgets_X11EXTRAS)
find_package(Qt${Qt_VERSION_MAJOR}X11Extras)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::X11Extras)
NOT APPLE
AND NOT EMSCRIPTEN
AND NOT KDDockWidgets_QT6
AND KDDockWidgets_X11EXTRAS
)
find_package(Qt${Qt_VERSION_MAJOR}X11Extras)
target_link_libraries(kddockwidgets PUBLIC Qt${Qt_VERSION_MAJOR}::X11Extras)
endif()
if(KDDockWidgets_XLib)
target_link_libraries(kddockwidgets PRIVATE X11)
target_link_libraries(kddockwidgets PRIVATE X11)
endif()
find_package(nlohmann_json)
if(nlohmann_json_FOUND)
target_link_libraries(kddockwidgets PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(kddockwidgets PRIVATE nlohmann_json::nlohmann_json)
else()
message("nlohmann_json not found in system. Using our own bundled one")
target_include_directories(kddockwidgets SYSTEM PRIVATE 3rdparty/nlohmann)
message("nlohmann_json not found in system. Using our own bundled one")
target_include_directories(kddockwidgets SYSTEM PRIVATE 3rdparty/nlohmann)
endif()
set_target_properties(
kddockwidgets PROPERTIES SOVERSION ${KDDockWidgets_SOVERSION}
VERSION ${KDDockWidgets_VERSION})
set_target_properties(kddockwidgets PROPERTIES SOVERSION ${KDDockWidgets_SOVERSION} VERSION ${KDDockWidgets_VERSION})
# version libraries on Windows
if(WIN32)
if(CMAKE_BUILD_TYPE)
set(postfix ${KDDockWidgets_VERSION_MAJOR})
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
if(${UPPER_BUILD_TYPE} MATCHES "^DEBUG")
string(CONCAT postfix ${postfix} "d")
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX ${postfix})
else()
set_target_properties(kddockwidgets PROPERTIES ${UPPER_BUILD_TYPE}_POSTFIX
${postfix})
if(CMAKE_BUILD_TYPE)
set(postfix ${KDDockWidgets_VERSION_MAJOR})
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
if(${UPPER_BUILD_TYPE} MATCHES "^DEBUG")
string(CONCAT postfix ${postfix} "d")
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX ${postfix})
else()
set_target_properties(kddockwidgets PROPERTIES ${UPPER_BUILD_TYPE}_POSTFIX ${postfix})
endif()
elseif(CMAKE_CONFIGURATION_TYPES)
# Visual Studio generator
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX d)
endif()
elseif(CMAKE_CONFIGURATION_TYPES)
# Visual Studio generator
set_target_properties(kddockwidgets PROPERTIES DEBUG_POSTFIX d)
endif()
endif()
install(
TARGETS kddockwidgets kdbindings
EXPORT kddockwidgetsTargets
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR})
TARGETS kddockwidgets kdbindings
EXPORT kddockwidgetsTargets
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
)
if(MSVC AND NOT KDDockWidgets_STATIC)
install(
FILES
"$<TARGET_PDB_FILE_DIR:kddockwidgets>/$<TARGET_PDB_FILE_NAME:kddockwidgets>"
DESTINATION ${INSTALL_LIBRARY_DIR}
CONFIGURATIONS Debug RelWithDebInfo)
install(
FILES "$<TARGET_PDB_FILE_DIR:kddockwidgets>/$<TARGET_PDB_FILE_NAME:kddockwidgets>"
DESTINATION ${INSTALL_LIBRARY_DIR}
CONFIGURATIONS Debug RelWithDebInfo
)
endif()
# install(FILES ${camelcase_HEADERS} DESTINATION
# ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${KDDW_PUBLIC_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${KDDW_PRIVATE_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private)
install(FILES ${KDDW_CONTROLLER_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/controllers)
install(FILES ${KDDW_VIEWINTERFACE_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/views)
install(
FILES ${KDDW_INDICATOR_HEADERS}
DESTINATION
${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/controllers/indicators)
install(FILES ${KDDW_PUBLIC_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${KDDW_PRIVATE_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private)
install(FILES ${KDDW_CONTROLLER_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/controllers)
install(FILES ${KDDW_VIEWINTERFACE_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/views)
install(FILES ${KDDW_INDICATOR_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/controllers/indicators)
if(KDDW_FRONTEND_QTWIDGETS)
set(KDDW_QTWIDGET_HEADERS qtwidgets/Platform_qtwidgets.h
qtwidgets/ViewFactory_qtwidgets.h)
set(KDDW_QTWIDGET_HEADERS qtwidgets/Platform_qtwidgets.h qtwidgets/ViewFactory_qtwidgets.h)
set(KDDW_QTWIDGET_VIEW_HEADERS
qtwidgets/views/DockWidget_qtwidgets.h
qtwidgets/views/Separator_qtwidgets.h
qtwidgets/views/RubberBand_qtwidgets.h
qtwidgets/views/SideBar_qtwidgets.h
qtwidgets/views/FloatingWindow_qtwidgets.h
qtwidgets/views/View_qtwidgets.h
qtwidgets/views/MainWindowMDI_qtwidgets.h
qtwidgets/views/ViewWrapper_qtwidgets.h
qtwidgets/views/MDILayout_qtwidgets.h
qtwidgets/views/MDIArea_qtwidgets.h
qtwidgets/views/DropArea_qtwidgets.h
qtwidgets/views/Stack_qtwidgets.h
qtwidgets/views/Group_qtwidgets.h
qtwidgets/views/TabBar_qtwidgets.h
qtwidgets/views/ClassicIndicatorsWindow_qtwidgets.h
qtwidgets/views/SegmentedIndicatorsOverlay_qtwidgets.h
qtwidgets/views/MainWindow_qtwidgets.h
qtwidgets/views/TitleBar_qtwidgets.h)
set(KDDW_QTWIDGET_VIEW_HEADERS
qtwidgets/views/DockWidget_qtwidgets.h
qtwidgets/views/Separator_qtwidgets.h
qtwidgets/views/RubberBand_qtwidgets.h
qtwidgets/views/SideBar_qtwidgets.h
qtwidgets/views/FloatingWindow_qtwidgets.h
qtwidgets/views/View_qtwidgets.h
qtwidgets/views/MainWindowMDI_qtwidgets.h
qtwidgets/views/ViewWrapper_qtwidgets.h
qtwidgets/views/MDILayout_qtwidgets.h
qtwidgets/views/MDIArea_qtwidgets.h
qtwidgets/views/DropArea_qtwidgets.h
qtwidgets/views/Stack_qtwidgets.h
qtwidgets/views/Group_qtwidgets.h
qtwidgets/views/TabBar_qtwidgets.h
qtwidgets/views/ClassicIndicatorsWindow_qtwidgets.h
qtwidgets/views/SegmentedIndicatorsOverlay_qtwidgets.h
qtwidgets/views/MainWindow_qtwidgets.h
qtwidgets/views/TitleBar_qtwidgets.h
)
set(KDDW_QTWIDGET_PRETTY_HEADERS
fwd_headers/qtwidgets_pretty/kddockwidgets/MainWindow.h
fwd_headers/qtwidgets_pretty/kddockwidgets/DockWidget.h)
set(KDDW_QTWIDGET_PRETTY_HEADERS fwd_headers/qtwidgets_pretty/kddockwidgets/MainWindow.h
fwd_headers/qtwidgets_pretty/kddockwidgets/DockWidget.h
)
install(FILES ${KDDW_QTWIDGET_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${KDDW_QTWIDGET_VIEW_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/views)
install(FILES ${KDDW_QTWIDGET_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${KDDW_QTWIDGET_VIEW_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/views)
if(KDockWidgets_PRETTY_QTWIDGETS_HEADERS)
install(FILES ${KDDW_QTWIDGET_PRETTY_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
endif()
if(KDockWidgets_PRETTY_QTWIDGETS_HEADERS)
install(FILES ${KDDW_QTWIDGET_PRETTY_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
endif()
endif()
if(KDDW_FRONTEND_QTQUICK)
set(KDDW_QTQUICK_HEADERS
qtquick/ViewFactory_qtquick.h qtquick/DockWidgetInstantiator.h
qtquick/Platform_qtquick.h qtquick/LayoutSaverInstantiator.h
qtquick/MainWindowInstantiator.h qtquick/MDIDockingAreaInstantiator.h)
set(KDDW_QTQUICK_HEADERS
qtquick/ViewFactory_qtquick.h qtquick/DockWidgetInstantiator.h qtquick/Platform_qtquick.h
qtquick/LayoutSaverInstantiator.h qtquick/MainWindowInstantiator.h qtquick/MDIDockingAreaInstantiator.h
)
set(KDDW_QTQUICK_VIEW_HEADERS
qtquick/views/ClassicIndicatorsWindow_qtquick.h
qtquick/views/View_qtquick.h
qtquick/views/Separator_qtquick.h
qtquick/views/MainWindowMDI_qtquick.h
qtquick/views/RubberBand_qtquick.h
qtquick/views/MainWindow_qtquick.h
qtquick/views/Separator_quick.h
qtquick/views/FloatingWindow_qtquick.h
qtquick/views/SideBar_qtquick.h
qtquick/views/TabBar_qtquick.h
qtquick/views/DockWidget_qtquick.h
qtquick/views/Stack_qtquick.h
qtquick/views/MDILayout_qtquick.h
qtquick/views/DropArea_qtquick.h
qtquick/views/Group_qtquick.h
qtquick/views/TitleBar_qtquick.h
qtquick/views/ViewWrapper_qtquick.h)
set(KDDW_QTQUICK_VIEW_HEADERS
qtquick/views/ClassicIndicatorsWindow_qtquick.h
qtquick/views/View_qtquick.h
qtquick/views/Separator_qtquick.h
qtquick/views/MainWindowMDI_qtquick.h
qtquick/views/RubberBand_qtquick.h
qtquick/views/MainWindow_qtquick.h
qtquick/views/Separator_quick.h
qtquick/views/FloatingWindow_qtquick.h
qtquick/views/SideBar_qtquick.h
qtquick/views/TabBar_qtquick.h
qtquick/views/DockWidget_qtquick.h
qtquick/views/Stack_qtquick.h
qtquick/views/MDILayout_qtquick.h
qtquick/views/DropArea_qtquick.h
qtquick/views/Group_qtquick.h
qtquick/views/TitleBar_qtquick.h
qtquick/views/ViewWrapper_qtquick.h
)
install(FILES ${KDDW_QTQUICK_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${KDDW_QTQUICK_VIEW_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/views)
install(FILES ${KDDW_QTQUICK_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
install(FILES ${KDDW_QTQUICK_VIEW_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/views)
endif()
if(KDDW_FRONTEND_QTWIDGETS OR KDDW_FRONTEND_QTQUICK)
set(KDDW_QT_HEADERS qtcommon/Platform_qt.h qtcommon/View_qt.h)
install(FILES ${KDDW_QT_HEADERS}
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
set(KDDW_QT_HEADERS qtcommon/Platform_qt.h qtcommon/View_qt.h)
install(FILES ${KDDW_QT_HEADERS} DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
endif()
# Generate library version files
include(ECMSetupVersion)
ecm_setup_version(
${KDDockWidgets_VERSION}
VARIABLE_PREFIX
KDDOCKWIDGETS
VERSION_HEADER
"${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
PACKAGE_VERSION_FILE
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
SOVERSION
${KDDockWidgets_SOVERSION}
COMPATIBILITY
AnyNewerVersion)
${KDDockWidgets_VERSION}
VARIABLE_PREFIX
KDDOCKWIDGETS
VERSION_HEADER
"${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
PACKAGE_VERSION_FILE
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
SOVERSION
${KDDockWidgets_SOVERSION}
COMPATIBILITY
AnyNewerVersion
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kddockwidgets_version.h"
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets)
DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets
)
install(
EXPORT kddockwidgetsTargets
FILE KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Targets.cmake
NAMESPACE KDAB::
DESTINATION
${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID})
configure_file(KDDockWidgetsConfig.cmake.in
KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake @ONLY)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
DESTINATION
${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID})
EXPORT kddockwidgetsTargets
FILE KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Targets.cmake
NAMESPACE KDAB::
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}
)
configure_file(KDDockWidgetsConfig.cmake.in KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}ConfigVersion.cmake"
DESTINATION ${INSTALL_LIBRARY_DIR}/cmake/KDDockWidgets${KDDockWidgets_LIBRARY_QTID}
)
if(KDDockWidgets_DEVELOPER_MODE)
# Under developer mode since kddw might be a sub-folder of a project setting a
# different value for QT_DISABLE_DEPRECATED_BEFORE
target_compile_definitions(kddockwidgets
PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060000)
# Under developer mode since kddw might be a sub-folder of a project setting a
# different value for QT_DISABLE_DEPRECATED_BEFORE
target_compile_definitions(kddockwidgets PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x060000)
option(KDDockWidgets_LINTER "Build the layout linter" ON)
option(KDDockWidgets_LINTER "Build the layout linter" ON)
if(KDDockWidgets_LINTER)
if(KDDockWidgets_LINTER)
set(LINTER_SRCS layoutlinter_main.cpp)
if(KDDW_FRONTEND_QTQUICK)
# QtQuick needs main.qml to create views
set(LINTER_SRCS ${LINTER_SRCS} ../tests/test_resources.qrc)
endif()
set(LINTER_SRCS layoutlinter_main.cpp)
if(KDDW_FRONTEND_QTQUICK)
# QtQuick needs main.qml to create views
set(LINTER_SRCS ${LINTER_SRCS} ../tests/test_resources.qrc)
add_executable(kddockwidgets_linter ${LINTER_SRCS})
target_link_libraries(kddockwidgets_linter kddockwidgets)
endif()
add_executable(kddockwidgets_linter ${LINTER_SRCS})
target_link_libraries(kddockwidgets_linter kddockwidgets)
endif()
endif()

View File

@@ -0,0 +1,12 @@
/*
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 "../../../private/DropAreaWithCentralFrame_p.h"

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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -10,7 +10,7 @@
#
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW)
cmake_policy(SET CMP0043 NEW)
endif()
find_package(Qt${Qt_VERSION_MAJOR}Test ${QT_MIN_VERSION} REQUIRED)
@@ -30,30 +30,24 @@ add_definitions(-DQT_NO_KEYWORDS)
# tst_docks
set(TESTING_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/test_resources.qrc)
add_executable(tst_docks tst_docks.cpp ${TESTING_SRCS} ${TESTING_RESOURCES})
target_link_libraries(tst_docks kdbindings kddockwidgets
Qt${Qt_VERSION_MAJOR}::Test)
target_link_libraries(tst_docks kdbindings kddockwidgets Qt${Qt_VERSION_MAJOR}::Test)
set_compiler_flags(tst_docks)
# tst_qtwidgets
if(KDDW_FRONTEND_QTWIDGETS)
add_executable(tst_qtwidgets qtwidgets/tst_qtwidgets.cpp ${TESTING_SRCS}
${TESTING_RESOURCES})
target_link_libraries(tst_qtwidgets kdbindings kddockwidgets
Qt${Qt_VERSION_MAJOR}::Test)
set_compiler_flags(tst_qtwidgets)
add_executable(tst_qtwidgets qtwidgets/tst_qtwidgets.cpp ${TESTING_SRCS} ${TESTING_RESOURCES})
target_link_libraries(tst_qtwidgets kdbindings kddockwidgets Qt${Qt_VERSION_MAJOR}::Test)
set_compiler_flags(tst_qtwidgets)
endif()
if(KDDW_FRONTEND_QTQUICK)
add_executable(tst_qtquick qtquick/tst_qtquick.cpp ${TESTING_SRCS}
${TESTING_RESOURCES})
target_link_libraries(tst_qtquick kddockwidgets kdbindings
Qt${Qt_VERSION_MAJOR}::Test)
set_compiler_flags(tst_qtquick)
add_executable(tst_qtquick qtquick/tst_qtquick.cpp ${TESTING_SRCS} ${TESTING_RESOURCES})
target_link_libraries(tst_qtquick kddockwidgets kdbindings Qt${Qt_VERSION_MAJOR}::Test)
set_compiler_flags(tst_qtquick)
endif()
add_executable(tst_multisplitter tst_multisplitter.cpp)
target_link_libraries(tst_multisplitter kddockwidgets kdbindings
Qt${Qt_VERSION_MAJOR}::Test)
target_link_libraries(tst_multisplitter kddockwidgets kdbindings Qt${Qt_VERSION_MAJOR}::Test)
set_compiler_flags(tst_multisplitter)
# tests_launcher
@@ -87,10 +81,8 @@ target_link_libraries(tst_tabbar kddockwidgets kdbindings)
add_executable(tst_separator controllers/tst_separator.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_separator kddockwidgets kdbindings)
add_executable(tst_floatingwindow controllers/tst_floatingwindow.cpp
${TESTING_RESOURCES})
add_executable(tst_floatingwindow controllers/tst_floatingwindow.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_floatingwindow kddockwidgets kdbindings)
add_executable(tst_dockwidget controllers/tst_dockwidget.cpp
${TESTING_RESOURCES})
add_executable(tst_dockwidget controllers/tst_dockwidget.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_dockwidget kddockwidgets kdbindings)

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: Sergio Martins <sergio.martins@kdab.com>
# 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
#
@@ -12,6 +12,5 @@
add_executable(fuzzer main.cpp Fuzzer.cpp Operations.cpp)
set_property(TARGET fuzzer PROPERTY CXX_STANDARD 17)
target_link_libraries(fuzzer kddockwidgets Qt${Qt_VERSION_MAJOR}::Widgets
Qt${Qt_VERSION_MAJOR}::Test)
target_link_libraries(fuzzer kddockwidgets Qt${Qt_VERSION_MAJOR}::Widgets Qt${Qt_VERSION_MAJOR}::Test)
set_compiler_flags(fuzzer)