Merge branch '1.6' into 2.0
This commit is contained in:
2
.krazy
2
.krazy
@@ -8,6 +8,8 @@ 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
|
||||
#exclude more checks
|
||||
EXCLUDE style
|
||||
|
||||
|
||||
59
README.md
59
README.md
@@ -1,8 +1,8 @@
|
||||
[](https://travis-ci.com/KDAB/KDDockWidgets)
|
||||
|
||||
|
||||
> ⚠️⚠️: 2.0 is under development, there might be API breaks before release.
|
||||
> Stick with version 1.6 if you're using QtWidgets. However, if you're using
|
||||
> ⚠️⚠️: 2.0 is under development, there might be API breaks before release.
|
||||
> Stick with version 1.6 if you're using QtWidgets. However, if you're using
|
||||
> QtQuick it's better to base on 2.0, as 1.6 won't be receiving much QtQuick development.
|
||||
|
||||
KDDockWidgets
|
||||
@@ -76,19 +76,29 @@ Screen capture
|
||||

|
||||
|
||||
|
||||
Trying out the examples
|
||||
=======================
|
||||
A full demo that showcases most of the features lives in [examples/dockwidgets](examples/dockwidgets).
|
||||
Building and requirements
|
||||
=========================
|
||||
|
||||
A simpler example can be found in [examples/minimal](examples/minimal),
|
||||
which might be more indicated to learn the API, as it's less overwhelming than the full demo.
|
||||
To build KDDockWidgets you'll need:
|
||||
|
||||
Open a terminal capable of building Qt5 applications.
|
||||
- CMake
|
||||
- Qt 5.15.x or Qt6 >= 6.2
|
||||
- Ninja (Other generators might work but are untested)
|
||||
- C++17 capable compiler
|
||||
- Qt Widgets module
|
||||
- Qt X11Extras module if on Linux/X11
|
||||
- Qt Quick and QuickControls2 modules if using the QtQuick support
|
||||
- Qt private development headers, for instance, for Qt5:
|
||||
- SUSE: libqt5-qtbase-private-headers-devel
|
||||
- Ubuntu, debian-based: qtbase5-private-dev
|
||||
- Fedora, redhat-based: qt5-qtbase-private-devel
|
||||
- others: consult your distro
|
||||
|
||||
|
||||
Open a terminal capable of building Qt applications.
|
||||
Make sure you have cmake, ninja, compiler, Qt, etc in PATH.
|
||||
|
||||
Adapt the instructions to suit your cmake generator and operating system.
|
||||
Build and install the KDDockWidgets framework (see the "Building" section
|
||||
below for more info):
|
||||
|
||||
```
|
||||
$ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/path/where/to/install ../path/to/kddockwidgets
|
||||
@@ -110,14 +120,23 @@ and `/usr/local/KDAB/KDDockWidgets-<version>` on non-Windows.
|
||||
|
||||
You can change the installation location by passing the option `-DCMAKE_INSTALL_PREFIX=/install/path` to cmake.
|
||||
|
||||
Building
|
||||
========
|
||||
On Linux distributions make sure to install the qt5 private development packages:
|
||||
|
||||
- SUSE: libqt5-qtbase-private-headers-devel
|
||||
- Ubuntu, debian-based: qtbase5-private-dev
|
||||
- Fedora, redhat-based: qt5-qtbase-private-devel
|
||||
- others: consult your distro
|
||||
Trying out the examples
|
||||
=======================
|
||||
A full demo that showcases most of the features lives in [examples/dockwidgets](examples/dockwidgets).
|
||||
|
||||
A simpler example can be found in [examples/minimal](examples/minimal),
|
||||
which might be more indicated to learn the API, as it's less overwhelming than the full demo.
|
||||
|
||||
To build and run the example:
|
||||
|
||||
```
|
||||
$ cd path/to/kddockwidgets/examples/dockwidgets/
|
||||
$ cmake -G Ninja -DCMAKE_PREFIX_PATH=/path/where/kddw/is/installed
|
||||
$ cmake --build .
|
||||
$ ./kddockwidgets_example
|
||||
```
|
||||
|
||||
|
||||
Using
|
||||
=====
|
||||
@@ -160,12 +179,6 @@ We don't promise or test binary compatibility. It's advised that you recompile
|
||||
your application whenever updating KDDW.
|
||||
|
||||
|
||||
Supported Qt versions and toolchains
|
||||
====================================
|
||||
KDDockWidgets requires a C++17 capable compiler and Qt 5.15.x or Qt6 >= 6.2
|
||||
For QtQuick support see [README-QtQuick.md](README-QtQuick.md).
|
||||
|
||||
|
||||
Styling
|
||||
========
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
/// @brief overload that just resizes widgets within a sub-tree
|
||||
void layoutEqually(Layouting::ItemBoxContainer *);
|
||||
|
||||
/// @brief Returns the number of items layed out horizontally or vertically
|
||||
/// @brief Returns the number of items layed-out horizontally or vertically
|
||||
/// But honours nesting
|
||||
int numSideBySide_recursive(Qt::Orientation) const;
|
||||
|
||||
|
||||
@@ -585,9 +585,18 @@ bool StateDraggingWayland::handleMouseButtonRelease(QPoint /*globalPos*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StateDraggingWayland::handleMouseMove(QPoint)
|
||||
{
|
||||
// Wayland uses QDrag to drag stuff while other platforms use mouse.
|
||||
// So override handleMouseMove() just so the regular mouse stuff doesn't run.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StateDraggingWayland::handleDragEnter(QDragEnterEvent *ev, DropArea *dropArea)
|
||||
{
|
||||
auto mimeData = qobject_cast<const WaylandMimeData *>(ev->mimeData());
|
||||
qCDebug(state) << Q_FUNC_INFO << mimeData << dropArea << q->m_windowBeingDragged.get();
|
||||
if (!mimeData || !q->m_windowBeingDragged)
|
||||
return false; // Not for us, some other user drag.
|
||||
|
||||
@@ -604,12 +613,14 @@ bool StateDraggingWayland::handleDragEnter(QDragEnterEvent *ev, DropArea *dropAr
|
||||
|
||||
bool StateDraggingWayland::handleDragLeave(DropArea *dropArea)
|
||||
{
|
||||
qCDebug(state) << Q_FUNC_INFO;
|
||||
dropArea->removeHover();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StateDraggingWayland::handleDrop(QDropEvent *ev, DropArea *dropArea)
|
||||
{
|
||||
qCDebug(state) << Q_FUNC_INFO;
|
||||
auto mimeData = qobject_cast<const WaylandMimeData *>(ev->mimeData());
|
||||
if (!mimeData || !q->m_windowBeingDragged)
|
||||
return false; // Not for us, some other user drag.
|
||||
@@ -775,6 +786,9 @@ bool DragController::eventFilter(QObject *o, QEvent *e)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (e->type() == QEvent::DragEnter && isDragging()) {
|
||||
// We're dragging a window. Be sure user code doesn't accept DragEnter events.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,14 +1004,18 @@ static DropArea *deepestDropAreaInTopLevel(std::shared_ptr<View> topLevel, QPoin
|
||||
DropArea *DragController::dropAreaUnderCursor() const
|
||||
{
|
||||
std::shared_ptr<View> topLevel = qtTopLevelUnderCursor();
|
||||
if (!topLevel)
|
||||
if (!topLevel) {
|
||||
qCDebug(state) << Q_FUNC_INFO << "No drop area under cursor";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QStringList affinities = m_windowBeingDragged->floatingWindow()->affinities();
|
||||
|
||||
if (auto fw = topLevel->asFloatingWindowController()) {
|
||||
if (DockRegistry::self()->affinitiesMatch(fw->affinities(), affinities))
|
||||
if (DockRegistry::self()->affinitiesMatch(fw->affinities(), affinities)) {
|
||||
qCDebug(state) << Q_FUNC_INFO << "Found drop area in floating window";
|
||||
return fw->dropArea();
|
||||
}
|
||||
}
|
||||
|
||||
if (topLevel->objectName() == QStringLiteral("_docks_IndicatorWindow")) {
|
||||
@@ -1006,6 +1024,7 @@ DropArea *DragController::dropAreaUnderCursor() const
|
||||
}
|
||||
|
||||
if (auto dt = deepestDropAreaInTopLevel(topLevel, QCursor::pos(), affinities)) {
|
||||
qCDebug(state) << Q_FUNC_INFO << "Found drop area" << dt << dt->view()->rootView()->asQObject();
|
||||
return dt;
|
||||
}
|
||||
|
||||
|
||||
@@ -261,6 +261,7 @@ public:
|
||||
bool handleDragMove(QDragMoveEvent *, Controllers::DropArea *) override;
|
||||
bool handleDragLeave(Controllers::DropArea *) override;
|
||||
bool handleDrop(QDropEvent *, Controllers::DropArea *) override;
|
||||
bool handleMouseMove(QPoint globalPos) override;
|
||||
bool m_inQDrag = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -481,7 +481,7 @@ public:
|
||||
bool isHorizontal() const;
|
||||
int length() const;
|
||||
|
||||
/// @brief Returns the number of visible items layed out horizontally or vertically
|
||||
/// @brief Returns the number of visible items layed-out horizontally or vertically
|
||||
/// But honours nesting
|
||||
int numSideBySide_recursive(Qt::Orientation) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user