Skip to content

Commit

Permalink
Merge branch '2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsergio committed Nov 29, 2023
2 parents 5e1c91e + a17bd4a commit a2b4e9b
Show file tree
Hide file tree
Showing 33 changed files with 222 additions and 74 deletions.
18 changes: 7 additions & 11 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Upstream-Contact: <[email protected]>
Source: https://www.github.com/KDAB/KDDockWidgets

#misc source code
Files: *.qrc *.json *.xml src/fwd_headers/*
Files: *.qrc *.json *.xml
Copyright: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
License: GPL-2.0-only OR GPL-3.0-only

#misc documentation
Files: CONTRIBUTORS.txt Changelog README.md README-porting.md README-QtQuick.md README-Flutter.md README-WASM.md README-Wayland.md README-bindings.md README-troubleshooting conan/README.txt python/examples/README.txt python/examples-qt6/README.txt docs_devel/*.md docs/KDDockWidgets-CopyrightAssignmentForm.pdf *.html src/3rdparty/qcoro/README examples/qtquick/customseparator/README.md docs/book/** book.toml
Files: CONTRIBUTORS.txt Changelog README.md README-porting.md README-QtQuick.md README-Flutter.md README-WASM.md README-Wayland.md README-troubleshooting conan/README.txt python/examples/README.txt python/examples-qt6/README.txt docs_devel/*.md docs/KDDockWidgets-CopyrightAssignmentForm.pdf *.html src/3rdparty/qcoro/README examples/qtquick/customseparator/README.md docs/book/** book.toml
Copyright: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
License: GPL-2.0-only OR GPL-3.0-only

Expand All @@ -23,8 +23,8 @@ Files: screencap.gif images/* src/img/* docs/api/*.png examples/dockwidgets/asse
Copyright: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
License: GPL-2.0-only OR GPL-3.0-only

#3rdparty
Files: cmake/ECM/modules/*
#3rdparty ECM (a few are missing reuse headers)
Files: cmake/ECM/modules/ECMVersionHeader.h.in cmake/ECM/modules/ecm_uninstall.cmake.in cmake/ECM/modules/BSD-3-Clause.txt
Copyright: The KDE Project
License: BSD-3-Clause

Expand All @@ -33,11 +33,7 @@ Files: src/3rdparty/kdbindings/genindex_array.h
Copyright: 2021 Jeremy Burns
License: MIT

Files: tests/flutter_tests_embedder/tests_embedder.cpp tests/flutter_tests_embedder/tests_embedder.h examples/flutter/windows/runner/runner.exe.manifest examples/flutter/windows/runner/resources/app_icon.ico
Copyright: Copyright 2013 The Flutter Authors
License: LicenseRef-FlutterBSD

# Flutter macOS autogenerated files
Files: examples/flutter/macos/** examples/flutter/.metadata
Copyright: Copyright 2013 The Flutter Authors
# Flutter
Files: tests/flutter_tests_embedder/tests_embedder.* examples/flutter/assets/* examples/flutter/macos/Runner/Configs/AppInfo.xcconfig examples/flutter/.metadata examples/flutter/macos/Runner/Assets.xcassets/* examples/flutter/macos/Runner.xcodeproj/* examples/flutter/macos/Flutter/* examples/flutter/macos/Runner.xcworkspace/* examples/flutter/macos/.gitignore examples/flutter/macos/Runner/Configs/*.xcconfig examples/flutter/macos/Runner/Base.lproj/MainMenu.xib examples/flutter/macos/Runner/DebugProfile.entitlements examples/flutter/macos/Runner/Info.plist examples/flutter/macos/Runner/Release.entitlements examples/flutter/windows/runner/resources/app_icon.ico examples/flutter/windows/runner/runner.exe.manifest
Copyright: Copyright 2013-2014 The Flutter Authors
License: LicenseRef-FlutterBSD
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion distro/qt5-kddockwidgets.spec
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
1.7.0 final
* Wed Sep 14 2022 Allen Winter <[email protected]> 1.6.0
1.6.0 final
* Mon Nov 24 2021 Allen Winter <[email protected]> 1.5.0
* Wed Nov 24 2021 Allen Winter <[email protected]> 1.5.0
1.5.0 final
* Fri Jul 16 2021 Allen Winter <[email protected]> 1.4.0
1.4.0 final
Expand Down
4 changes: 2 additions & 2 deletions distro/qt6-kddockwidgets.spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=
%dir %{_libdir}/cmake/KDDockWidgets-qt6
%{_libdir}/cmake/KDDockWidgets-qt6/*
%{_libdir}/libkddockwidgets-qt6.so
#%{_prefix}/mkspecs/modules/* ECMGeneratePriFile isn't ported to Qt6 yet
%{_libdir}/qt6/mkspecs/modules/*

%changelog
* Tue Nov 21 2023 Allen Winter <[email protected]> 2.0.0
Expand All @@ -93,7 +93,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_QT6=True -DCMAKE_BUILD_TYPE=
1.7.0 final
* Wed Sep 14 2022 Allen Winter <[email protected]> 1.6.0
1.6.0 final
* Mon Nov 24 2021 Allen Winter <[email protected]> 1.5.0
* Wed Nov 24 2021 Allen Winter <[email protected]> 1.5.0
1.5.0 final
* Fri Jul 16 2021 Allen Winter <[email protected]> 1.4.0
1.4.0 final
Expand Down
1 change: 0 additions & 1 deletion docs/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ add_custom_command(
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
Expand Down
4 changes: 3 additions & 1 deletion docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
- [Custom Behaviour](custom_behaviour.md)
- [Custom Styling](custom_styling.md)
- [Public and Private API](private_api.md)

---
- [For Developers]()
- [Architecture and Concepts](architecture_and_concepts.md)
---
- [Roadmap](roadmap.md)
- [Get Involved](involved.md)
Expand Down
37 changes: 37 additions & 0 deletions docs/book/src/architecture_and_concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Architecture and Concepts

`KDDockWidgets` is divided into `Core` and one `frontend` for each supported `GUI toolkit`.<br>
The `Core` is pure `C++` with no dependency on `Qt`. Business logic and state often lives here, and classes are
namespaced with `KDDockWidgets::Core::`.<br>
We have two complete frontends, `qtwidgets` and `qtquick` and a third one called `flutter`, which is lacking some futures still. Their code is namespaced with `KDDockWidgets::QtWidgets`, `KDDockWidgets::QtQuick` and `KDDockWidgets::Flutter` respectively.

## Views and Controllers

`View` is a fancy word that meant `QWidget`. Since we introduced support for non-QtWidget toolkits we needed to drop the QWidget nomenculature. For QtQuick, views are `QQuickItem`s, and for Flutter, they are `StatefullWidget`.

While views are something graphical, which depends on the rendering technology you're using, `Controllers` on the other hand are gui-agnostic, they live in `Core`, and are reused by all frontends.

Here's a list of controllers and views:
- TitleBar
- TabBar
- Stack
- Group
- DockWidget
- MainWindow
- FloatingWindow
- DropArea

For each of the above there's a View and a Controller. For example, for TitleBar, there's `Core::TitleBar`, implemented in `src/core/TitleBar.cpp`, which is rendered by `QtWidgets::TitleBar` (or `QtQuick::TitleBar` or `Flutter::TitleBar`), implemented in `/src/qtwidgets/views/TitleBar.cpp` and so on.

Porting to another GUI toolkit involves reimplementing all views.

## Platform, Screen, Window, ViewFactory
Not everything is a View/Controller. There's a bunch of other abstractions that need to be implemented when creating a new frontend.

While Qt has `QGuiApplication`, `QScreen`, `QWindow` we have similar abstractions but in a more toolkit agnostic way. See all the pure virtual methods in Core::Platform, Core::Screen, Core::Window and View::Factory and implement them.

## Layouting engine

This is like the core of the core, it lives in src/core/layouting. The code there doesn't know anything about docking
or dnd. It implements our layouting, which is a recursively nested layout. Imagine a layout composed nested QVBoxLayout and QHBoxLayout supporting any depth. min/max/preferred sizes are supported and recursively propagated up.
See `src/core/layouting/examples` for how to use just this layouting engine without any docking. This is pure C++ and doesn't depend on Qt.
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else()
endif()
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}/${BINDINGS_DIR}")

include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
include(KDPySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
add_subdirectory(PyKDDockWidgets)
if(${PROJECT_NAME}_TESTS)
add_subdirectory(tests)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ if(KDDW_FRONTEND_QT)
if(MSVC AND NOT KDDockWidgets_STATIC)
install(
FILES "$<TARGET_PDB_FILE_DIR:kddockwidgets>/$<TARGET_PDB_FILE_NAME:kddockwidgets>"
DESTINATION ${INSTALL_LIBRARY_DIR}
DESTINATION ${INSTALL_RUNTIME_DIR}
CONFIGURATIONS Debug RelWithDebInfo
)
endif()
Expand Down
8 changes: 8 additions & 0 deletions src/core/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ int View::minimumHeight() const
return minSize().height();
}

Size View::screenSize() const
{
if (auto screen = d->screen())
return screen->size();

return {};
}

Controller *View::controller() const
{
return m_controller;
Expand Down
3 changes: 3 additions & 0 deletions src/core/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ class DOCKS_EXPORT View
int minimumWidth() const;
int minimumHeight() const;

/// Returns the size of the screen that this view belongs to
Size screenSize() const;

/// The minimum minimum size a dock widget can have
static Size hardcodedMinimumSize();

Expand Down
4 changes: 0 additions & 4 deletions src/core/layouting/examples/qtwidgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,3 @@ if(NOT TARGET nlohmann_json::nlohmann_json)
include(../../../../nlohmann.cmake)
link_to_nlohman(qtwidgets_standalone_layouting)
endif()

set_target_properties(
qtwidgets_standalone_layouting PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/"
)
2 changes: 2 additions & 0 deletions src/qtcommon/TestHelpers_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ void Platform_qt::tests_deinitPlatform_impl()
}

/*static*/
QT_BEGIN_NAMESPACE
extern quintptr Q_CORE_EXPORT qtHookData[];
QT_END_NAMESPACE
bool Platform_qt::isGammaray()
{
static bool is = qtHookData[3] != 0;
Expand Down
6 changes: 6 additions & 0 deletions src/qtquick/views/DropArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_DROPAREA_QTQUICK_H
#define KD_DROPAREA_QTQUICK_H

#pragma once

#include "View.h"
Expand All @@ -33,4 +36,7 @@ class DOCKS_EXPORT DropArea : public QtQuick::View
};

}

}

#endif
6 changes: 6 additions & 0 deletions src/qtquick/views/MDILayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_MDILAYOUT_QTQUICK_H
#define KD_MDILAYOUT_QTQUICK_H

#pragma once

#include "kddockwidgets/docks_export.h"
Expand All @@ -35,4 +38,7 @@ class DOCKS_EXPORT MDILayout : public QtQuick::View
};

}

}

#endif
3 changes: 3 additions & 0 deletions src/qtquick/views/SideBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_SIDEBAR_QTQUICK_H
#define KD_SIDEBAR_QTQUICK_H

#pragma once

#include "View.h"
Expand Down
5 changes: 5 additions & 0 deletions src/qtquick/views/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_VIEW_QTQUICK_H
#define KD_VIEW_QTQUICK_H

#pragma once

#include "kddockwidgets/core/Controller.h"
Expand Down Expand Up @@ -218,3 +221,5 @@ inline qreal logicalDpiFactor(const QQuickItem *item)
}

}

#endif
5 changes: 5 additions & 0 deletions src/qtquick/views/ViewWrapper_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_VIEWWRAPPER_QTQUICK_H
#define KD_VIEWWRAPPER_QTQUICK_H

#pragma once

#include "../../qtcommon/ViewWrapper_p.h"
Expand Down Expand Up @@ -74,3 +77,5 @@ class DOCKS_EXPORT ViewWrapper : public QtCommon::ViewWrapper
};

}

#endif
5 changes: 5 additions & 0 deletions src/qtwidgets/views/DropArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* @author Sérgio Martins \<[email protected]\>
*/

#ifndef KD_DROPAREA_QTWIDGETS_H
#define KD_DROPAREA_QTWIDGETS_H
#pragma once

#include "kddockwidgets/docks_export.h"
Expand Down Expand Up @@ -43,4 +45,7 @@ class DOCKS_EXPORT DropArea : public QtWidgets::View<QWidget>
};

}

}

#endif
6 changes: 6 additions & 0 deletions src/qtwidgets/views/FloatingWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_FLOATINGWINDOW_QTWIDGETS_H
#define KD_FLOATINGWINDOW_QTWIDGETS_H

#pragma once

#include "View.h"
Expand Down Expand Up @@ -58,4 +61,7 @@ class DOCKS_EXPORT FloatingWindow : public View<QWidget>
void updateMargins();
Q_DISABLE_COPY(FloatingWindow)
};

}

#endif
5 changes: 5 additions & 0 deletions src/qtwidgets/views/Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_GROUP_QTWIDGETS_H
#define KD_GROUP_QTWIDGETS_H

#pragma once

#include "View.h"
Expand Down Expand Up @@ -41,3 +44,5 @@ class DOCKS_EXPORT Group : public View<QWidget>, public Core::GroupViewInterface
};

}

#endif
6 changes: 6 additions & 0 deletions src/qtwidgets/views/MDILayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_MDILAYOUT_QTWIDGETS_H
#define KD_MDILAYOUT_QTWIDGETS_H

#pragma once

#include "kddockwidgets/docks_export.h"
Expand All @@ -35,4 +38,7 @@ class DOCKS_EXPORT MDILayout : public QtWidgets::View<QWidget>
};

}

}

#endif
5 changes: 5 additions & 0 deletions src/qtwidgets/views/RubberBand.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_RUBBERBAND_QTWIDGETS_H
#define KD_RUBBERBAND_QTWIDGETS_H

#pragma once

#include "View.h"
Expand All @@ -30,3 +33,5 @@ class DOCKS_EXPORT RubberBand : public View<QRubberBand>
}

}

#endif
5 changes: 5 additions & 0 deletions src/qtwidgets/views/SegmentedDropIndicatorOverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_SEGMENTEDDROPINDICATOROVERLAY_QTWIDGETS_H
#define KD_SEGMENTEDDROPINDICATOROVERLAY_QTWIDGETS_H

#pragma once

#include "View.h"
Expand Down Expand Up @@ -45,3 +48,5 @@ class DOCKS_EXPORT SegmentedDropIndicatorOverlay : public View<QWidget>
}

}

#endif
5 changes: 5 additions & 0 deletions src/qtwidgets/views/Separator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_SEPARATOR_QTWIDGETS_H
#define KD_SEPARATOR_QTWIDGETS_H

#pragma once

#include "View.h"
Expand Down Expand Up @@ -41,3 +44,5 @@ class DOCKS_EXPORT Separator : public View<QWidget>
};

}

#endif
4 changes: 4 additions & 0 deletions src/qtwidgets/views/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
Contact KDAB at <[email protected]> for commercial licensing options.
*/

#ifndef KD_STACK_QTWIDGETS_H
#define KD_STACK_QTWIDGETS_H

#pragma once

Expand Down Expand Up @@ -57,3 +59,5 @@ class DOCKS_EXPORT Stack : public View<QTabWidget>, public Core::StackViewInterf

}
}

#endif
Loading

0 comments on commit a2b4e9b

Please sign in to comment.