Compare commits

...

1 Commits

Author SHA1 Message Date
Sergio Martins
233449c844 wip 2022-07-21 15:06:39 +01:00

View File

@@ -20,6 +20,7 @@
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <qnamespace.h>
// clazy:excludeall=qstring-allocations // clazy:excludeall=qstring-allocations
@@ -140,6 +141,10 @@ int main(int argc, char **argv)
QCoreApplication::translate("main", "Illustrates usage of Config::setDropIndicatorAllowedFunc()")); QCoreApplication::translate("main", "Illustrates usage of Config::setDropIndicatorAllowedFunc()"));
parser.addOption(hideCertainDockingIndicators); parser.addOption(hideCertainDockingIndicators);
QCommandLineOption requireControlKey("require-control-key",
QCoreApplication::translate("main", "The user will have to hold the ctrl key to see drop indicators while dragging"));
parser.addOption(requireControlKey);
#if defined(DOCKS_DEVELOPER_MODE) #if defined(DOCKS_DEVELOPER_MODE)
parser.addOption(centralFrame); parser.addOption(centralFrame);
@@ -279,11 +284,21 @@ int main(int argc, char **argv)
return (location & KDDockWidgets::DropLocation_Outter) || !isDraggingDW8; return (location & KDDockWidgets::DropLocation_Outter) || !isDraggingDW8;
}; };
KDDockWidgets::Config::self().setDropIndicatorAllowedFunc(func);
} else if (parser.isSet(requireControlKey)) {
auto func = [](KDDockWidgets::DropLocation,
const KDDockWidgets::DockWidgetBase::List &,
const KDDockWidgets::DockWidgetBase::List &,
KDDockWidgets::DropArea *) -> bool {
return qApp->keyboardModifiers() & Qt::ControlModifier;
};
KDDockWidgets::Config::self().setDropIndicatorAllowedFunc(func); KDDockWidgets::Config::self().setDropIndicatorAllowedFunc(func);
} }
KDDockWidgets::Config::self().setFlags(flags); KDDockWidgets::Config::self().setFlags(flags);
const bool nonClosableDockWidget0 = parser.isSet(nonClosableDockWidget); const bool nonClosableDockWidget0 = parser.isSet(nonClosableDockWidget);
const bool restoreIsRelative = parser.isSet(relativeRestore); const bool restoreIsRelative = parser.isSet(relativeRestore);
const bool nonDockableDockWidget9 = parser.isSet(nonDockable); const bool nonDockableDockWidget9 = parser.isSet(nonDockable);