Pass the DropArea to setDropIndicatorAllowedFunc() too

So the lambda can have more advanced usage and inspect the
target layout before allowing or disallowing the drop.

For our use case, we want to limit max 3 dock widgets side by side,
for example.

(cherry-picked from commit 982904e2ba)
This commit is contained in:
Sergio Martins
2022-06-19 14:22:12 +01:00
parent 7b4e04703d
commit 104a065aeb
4 changed files with 13 additions and 5 deletions

View File

@@ -271,7 +271,8 @@ int main(int argc, char **argv)
// Dock widget 8 will only be allowed to dock to the outter areas
auto func = [](KDDockWidgets::DropLocation location,
const KDDockWidgets::Controllers::DockWidget::List &source,
const KDDockWidgets::Controllers::DockWidget::List &target) {
const KDDockWidgets::Controllers::DockWidget::List &target,
Controllers::DropArea *) {
Q_UNUSED(target); // When dragging into a tab, 'target' would have the list of already tabbed dock widgets
const bool isDraggingDW8 = std::find_if(source.cbegin(), source.cend(), [](KDDockWidgets::Controllers::DockWidget *dw) {