diff --git a/src/private/DockRegistry.cpp b/src/private/DockRegistry.cpp index b8ebbe17..d6936ae0 100644 --- a/src/private/DockRegistry.cpp +++ b/src/private/DockRegistry.cpp @@ -26,8 +26,6 @@ #include "controllers/DockWidget.h" #include "controllers/DockWidget_p.h" -#include "qtwidgets/views/Frame_qtwidgets.h" - #include #include #include @@ -670,9 +668,10 @@ bool DockRegistry::eventFilter(QObject *watched, QEvent *event) } } else if (event->type() == QEvent::MouseButtonPress) { // When clicking on a MDI Frame we raise the window - if (auto frameView = firstParentOfType(watched)) { - if (frameView->frame()->isMDI()) - frameView->raise(); + if (Controller *c = View::firstParentOfType(watched, Type::Frame)) { + auto frame = static_cast(c); + if (frame->isMDI()) + frame->view()->raise(); } // The following code is for hididng the overlay diff --git a/src/private/Utils_p.h b/src/private/Utils_p.h index 254a97ce..70847857 100644 --- a/src/private/Utils_p.h +++ b/src/private/Utils_p.h @@ -269,32 +269,6 @@ inline bool scalingFactorIsSupported(qreal factor) #endif } -template -inline T *firstParentOfType(const QObject *child) -{ - auto p = const_cast(child); - while (p) { - if (auto candidate = qobject_cast(p)) - return candidate; - - if (qobject_cast(p)) { - // Ignore QObject hierarchies spanning though multiple windows - return nullptr; - } - -#ifdef KDDOCKWIDGETS_QTWIDGETS - // Ignore QObject hierarchies spanning though multiple windows - if (auto w = qobject_cast(p)) - if (w->isWindow()) - return nullptr; -#endif - - p = p->parent(); - } - - return nullptr; -} - }; #endif