From 2ff90936042f0948c4a7bc5d9608c390f02c9886 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 16 Feb 2022 09:46:49 +0200 Subject: [PATCH] effects/desktopgrid: Port to QStyleHints Let's us avoid making the desktop grid effect depend on qtwidgets. CCBUG: 450359 --- src/effects/desktopgrid/desktopgrid.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/effects/desktopgrid/desktopgrid.cpp b/src/effects/desktopgrid/desktopgrid.cpp index b5b76efc04..5db35c6961 100644 --- a/src/effects/desktopgrid/desktopgrid.cpp +++ b/src/effects/desktopgrid/desktopgrid.cpp @@ -17,12 +17,13 @@ #include "../presentwindows/presentwindows_proxy.h" #include -#include +#include #include #include #include #include #include +#include #include #include #include @@ -129,7 +130,7 @@ DesktopGridEffect::DesktopGridEffect() } }); - windowMoveElevateTimer->setInterval(QApplication::startDragTime()); + windowMoveElevateTimer->setInterval(QGuiApplication::styleHints()->startDragTime()); windowMoveElevateTimer->setSingleShot(true); connect(windowMoveElevateTimer, &QTimer::timeout, this, [this]() { effects->setElevatedWindow(windowMove, true); @@ -503,7 +504,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) if (e->type() == QEvent::MouseMove) { int d = posToDesktop(me->pos()); if (windowMove != nullptr && - (me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) { + (me->pos() - dragStartPos).manhattanLength() > QGuiApplication::styleHints()->startDragDistance()) { // Handle window moving if (windowMoveElevateTimer->isActive()) { // Window started moving, but is not elevated yet! windowMoveElevateTimer->stop(); @@ -561,7 +562,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) effects->addRepaintFull(); } } else if ((me->buttons() & Qt::LeftButton) && !wasDesktopMove && - (me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) { + (me->pos() - dragStartPos).manhattanLength() > QGuiApplication::styleHints()->startDragDistance()) { wasDesktopMove = true; effects->defineCursor(Qt::ClosedHandCursor); }