Remove more asQWidget() instances, only 3 remaining now
This commit is contained in:
@@ -644,7 +644,7 @@ bool DockWidget::Private::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
const bool isWindowActivate = event->type() == QEvent::WindowActivate;
|
||||
const bool isWindowDeactivate = event->type() == QEvent::WindowDeactivate;
|
||||
if ((isWindowActivate || isWindowDeactivate) && watched == q->view()->asQWidget()->window())
|
||||
if ((isWindowActivate || isWindowDeactivate) && watched == q->view()->window()->asQObject())
|
||||
Q_EMIT q->windowActiveAboutToChange(isWindowActivate);
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
|
||||
@@ -582,7 +582,8 @@ Controllers::FloatingWindow *DockRegistry::floatingWindowForHandle(Window::Ptr w
|
||||
Controllers::FloatingWindow *DockRegistry::floatingWindowForHandle(WId hwnd) const
|
||||
{
|
||||
for (Controllers::FloatingWindow *fw : m_floatingWindows) {
|
||||
if (fw->view()->asQWidget()->windowHandle() && fw->view()->asQWidget()->windowHandle()->winId() == hwnd)
|
||||
Window::Ptr window = fw->view()->windowHandle();
|
||||
if (window && window->handle() == hwnd)
|
||||
return fw;
|
||||
}
|
||||
|
||||
@@ -599,17 +600,6 @@ Controllers::MainWindow *DockRegistry::mainWindowForHandle(Window::Ptr window) c
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QWidgetOrQuick *DockRegistry::topLevelForHandle(Window::Ptr windowHandle) const
|
||||
{
|
||||
if (auto fw = floatingWindowForHandle(windowHandle))
|
||||
return fw->view()->asQWidget();
|
||||
|
||||
if (auto mw = mainWindowForHandle(windowHandle))
|
||||
return mw->view()->asQWidget();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Window::List DockRegistry::topLevels(bool excludeFloatingDocks) const
|
||||
{
|
||||
Window::List windows;
|
||||
@@ -669,7 +659,7 @@ void DockRegistry::clear(const DockWidgetBase::List &dockWidgets,
|
||||
void DockRegistry::ensureAllFloatingWidgetsAreMorphed()
|
||||
{
|
||||
for (DockWidgetBase *dw : qAsConst(m_dockWidgets)) {
|
||||
if (dw->view()->asQWidget()->window() == dw->view()->asQWidget() && dw->isVisible())
|
||||
if (dw->view()->window()->equals(dw->view()) && dw->isVisible())
|
||||
dw->d->morphIntoFloatingWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,11 +128,6 @@ public:
|
||||
///@brief returns the MainWindow with handle @p windowHandle
|
||||
Controllers::MainWindow *mainWindowForHandle(Window::Ptr windowHandle) const;
|
||||
|
||||
///@brief returns the top level widget associated with the specified QWindow.
|
||||
/// For QtWidgets, it returns a QWidget which is either a KDDockWidgets::MainWindow or a FloatingWindow.
|
||||
/// For QtQuick ir returns the same, but the type is a QWidgetAdapter (a QQuickItem), not QWidget obviously.
|
||||
QWidgetOrQuick *topLevelForHandle(Window::Ptr windowHandle) const;
|
||||
|
||||
///@brief Returns the list with all visiblye top-level parents of our FloatingWindow and MainWindow instances.
|
||||
///
|
||||
/// Typically these are the FloatingWindows and MainWindows themselves. However, since a
|
||||
|
||||
Reference in New Issue
Block a user