Don't make all DropArea views all DropArea::onResized()

Do it in the controller once, instead of repeating it
This commit is contained in:
Sergio Martins
2022-06-17 20:06:51 +01:00
parent c48a100f73
commit 499c9412bb
10 changed files with 3 additions and 36 deletions

View File

@@ -33,6 +33,8 @@ Layout::Layout(Type type, View *view)
view->layoutInvalidated.connect([this] {
updateSizeConstraints();
});
view->resized.connect(&Layout::onResize, this);
}
Layout::~Layout()

View File

@@ -199,10 +199,6 @@ public:
/// @brief Emitted when the count of visible widgets changes
KDBindings::Signal<int> visibleWidgetCountChanged;
/// TODOm3: Better a signal, so that derived classes don't have to remember to call these
bool onResize(QSize newSize);
/// TODOm3: Remove
void viewAboutToBeDeleted();
Layouting::ItemContainer *rootItem() const;
@@ -234,6 +230,7 @@ protected:
QList<Controllers::Frame *> framesFrom(View *frameOrMultiSplitter) const;
private:
bool onResize(QSize newSize);
bool m_inResizeEvent = false;
Layouting::ItemContainer *m_rootItem = nullptr;
KDBindings::ConnectionHandle m_minSizeChangedHandler;

View File

@@ -31,8 +31,3 @@ DropArea_qtquick::~DropArea_qtquick()
if (!freed())
m_dropArea->viewAboutToBeDeleted();
}
bool DropArea_qtquick::onResize(QSize newSize)
{
return m_dropArea->onResize(newSize);
}

View File

@@ -28,9 +28,6 @@ public:
explicit DropArea_qtquick(Controllers::DropArea *, View *parent);
~DropArea_qtquick();
/// TODOm3
bool onResize(QSize newSize) override;
private:
Controllers::DropArea *const m_dropArea;
};

View File

@@ -27,8 +27,3 @@ MDILayout_qtquick::~MDILayout_qtquick()
if (!freed())
m_controller->viewAboutToBeDeleted();
}
bool MDILayout_qtquick::onResize(QSize newSize)
{
return m_controller->onResize(newSize);
}

View File

@@ -28,9 +28,6 @@ public:
explicit MDILayout_qtquick(Controllers::MDILayout *controller, View *parent);
~MDILayout_qtquick();
/// TODOm3
bool onResize(QSize newSize) override;
private:
Controllers::MDILayout *const m_controller;
};

View File

@@ -31,8 +31,3 @@ DropArea_qtwidgets::~DropArea_qtwidgets()
if (!freed())
m_dropArea->viewAboutToBeDeleted();
}
bool DropArea_qtwidgets::onResize(QSize newSize)
{
return m_dropArea->onResize(newSize);
}

View File

@@ -38,9 +38,6 @@ public:
explicit DropArea_qtwidgets(Controllers::DropArea *, View *parent);
~DropArea_qtwidgets();
/// TODOm3
bool onResize(QSize newSize) override;
private:
Controllers::DropArea *const m_dropArea;
};

View File

@@ -27,8 +27,3 @@ MDILayout_qtwidgets::~MDILayout_qtwidgets()
if (!freed())
m_controller->viewAboutToBeDeleted();
}
bool MDILayout_qtwidgets::onResize(QSize newSize)
{
return m_controller->onResize(newSize);
}

View File

@@ -29,9 +29,6 @@ public:
explicit MDILayout_qtwidgets(Controllers::MDILayout *controller, View *parent);
~MDILayout_qtwidgets();
/// TODOm3
bool onResize(QSize newSize) override;
private:
Controllers::MDILayout *const m_controller;
};