]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinnavigatorswidgetaction.cpp
Port to Qt6
[dolphin.git] / src / dolphinnavigatorswidgetaction.cpp
index 47a2a2303454b78998a62e45b864c859b590eaf8..cb2e4bc002862cb47bc8b748fb9f623681ab6d60 100644 (file)
@@ -42,7 +42,7 @@ DolphinNavigatorsWidgetAction::DolphinNavigatorsWidgetAction(QWidget *parent)
 
 void DolphinNavigatorsWidgetAction::adjustSpacing()
 {
-    m_previousWindowWidth = parentWidget()->window()->width();
+    m_previousWindowWidth = qobject_cast<QWidget *>(parent())->window()->width();
     auto viewGeometries = m_viewGeometriesHelper.viewGeometries();
     const int widthOfSplitterPrimary = viewGeometries.globalXOfPrimary + viewGeometries.widthOfPrimary - viewGeometries.globalXOfNavigatorsWidget;
     const QList<int> splitterSizes = {widthOfSplitterPrimary, m_splitter->width() - widthOfSplitterPrimary};
@@ -298,7 +298,7 @@ DolphinNavigatorsWidgetAction::ViewGeometriesHelper::ViewGeometriesHelper(QWidge
 bool DolphinNavigatorsWidgetAction::ViewGeometriesHelper::eventFilter(QObject *watched, QEvent *event)
 {
     if (event->type() == QEvent::Resize) {
-        if (m_navigatorsWidgetAction->parentWidget()->window()->width() != m_navigatorsWidgetAction->m_previousWindowWidth) {
+        if (qobject_cast<QWidget*>(m_navigatorsWidgetAction->parent())->window()->width() != m_navigatorsWidgetAction->m_previousWindowWidth) {
             // The window is being resized which means not all widgets have gotten their new sizes yet.
             // Let's wait a bit so the sizes of the navigatorsWidget and the viewContainers have all
             // had a chance to be updated.