qtquick: Fix frame not getting parented to DropArea

This commit is contained in:
Sergio Martins
2022-06-04 12:32:20 +01:00
parent 6c5f477c31
commit e5b82e0a45
3 changed files with 26 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ public:
virtual bool isNull() const;
/// @brief Called by the layouting engine
/// Override it in case your widget needs to know where it is in the layout. Usually only needed by Frame.s
/// Override it in case your widget needs to know where it is in the layout. Usually only needed by Frame.
virtual void setLayoutItem(Layouting::Item *) {};
virtual void setParent(View *) = 0;

View File

@@ -266,3 +266,23 @@ int Frame_qtquick::userType() const
/// TODOv2
return 0;
}
bool Frame_qtquick::event(QEvent *e)
{
// TODOv2: Move to controller. Too much logic to be here, and it's duplicated
// with QtWidgets
if (freed())
return View_qtquick::event(e);
if (e->type() == QEvent::ParentChange) {
auto p = parentView();
m_controller->setLayout(p ? p->asLayout() : nullptr);
}
return View_qtquick::event(e);
}
void Frame_qtquick::setLayoutItem(Layouting::Item *item)
{
m_controller->setLayoutItem(item);
}

View File

@@ -56,6 +56,9 @@ public:
QRect dragRect() const override;
// TODOv2: Move this to a common base class between qtquick and qtwidgets
void setLayoutItem(Layouting::Item *item) override;
// QML interface:
bool isMDI() const;
KDDockWidgets::Views::TitleBar_qtquick *titleBar() const;
@@ -63,7 +66,9 @@ public:
int userType() const;
QObject *tabWidgetObj() const;
protected:
bool event(QEvent *) override;
void removeWidget_impl(Controllers::DockWidget *) override;
int indexOfDockWidget_impl(const Controllers::DockWidget *) override;
int currentIndex_impl() const override;