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.
This commit is contained in:
Sergio Martins
2022-06-02 15:19:01 +01:00
parent b2b75cd5bb
commit 982904e2ba
4 changed files with 13 additions and 5 deletions

View File

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