Delete QObject::setParent() in the controller
To find places where we're setting parent on the controller instead of in the view. Fix such case where the dock widget view wasn't being parented to the frame view.
This commit is contained in:
@@ -81,6 +81,7 @@ public:
|
||||
bool inDtor() const;
|
||||
|
||||
private:
|
||||
void setParent(QObject *) = delete;
|
||||
View *m_view = nullptr;
|
||||
bool m_inDtor = false;
|
||||
const Type m_type;
|
||||
|
||||
@@ -112,7 +112,7 @@ void DockWidget::addDockWidgetAsTab(DockWidget *other, InitialOption option)
|
||||
}
|
||||
}
|
||||
|
||||
other->setParent(nullptr);
|
||||
other->view()->setParent(nullptr);
|
||||
frame->addWidget(other, option);
|
||||
}
|
||||
|
||||
@@ -384,6 +384,7 @@ QStringList DockWidget::affinities() const
|
||||
|
||||
void DockWidget::show()
|
||||
{
|
||||
// TODOv2: show wont be called. move to view instead.
|
||||
if (view()->isRootView() && (d->m_lastPosition->wasFloating() || !d->m_lastPosition->isValid())) {
|
||||
// Create the FloatingWindow already, instead of waiting for the show event.
|
||||
// This reduces flickering on some platforms
|
||||
@@ -734,7 +735,7 @@ void DockWidget::Private::close()
|
||||
|
||||
// Do some cleaning. Widget is hidden, but we must hide the tab containing it.
|
||||
if (Controllers::Frame *frame = this->frame()) {
|
||||
q->setParent(nullptr);
|
||||
q->QObject::setParent(nullptr);
|
||||
q->view()->setParent(nullptr);
|
||||
frame->removeWidget(q);
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ void MainWindow::clearSideBarOverlay(bool deleteFrame)
|
||||
frame->unoverlay();
|
||||
|
||||
if (deleteFrame) {
|
||||
d->m_overlayedDockWidget->setParent(nullptr);
|
||||
d->m_overlayedDockWidget->QObject::setParent(nullptr);
|
||||
d->m_overlayedDockWidget->view()->setParent(nullptr);
|
||||
Q_EMIT d->m_overlayedDockWidget->isOverlayedChanged(false);
|
||||
d->m_overlayedDockWidget = nullptr;
|
||||
|
||||
@@ -142,7 +142,8 @@ void Frame_qtquick::insertDockWidget_impl(Controllers::DockWidget *dw, int index
|
||||
{
|
||||
QPointer<Controllers::Frame> oldFrame = dw->d->frame();
|
||||
if (stackView()->insertDockWidget(index, dw, {}, {})) {
|
||||
dw->setParent(m_stackLayout);
|
||||
|
||||
asView_qtquick(dw->view())->setParent(m_stackLayout);
|
||||
|
||||
QMetaObject::Connection conn = connect(dw, &Controllers::DockWidget::parentChanged, this, [dw, this] {
|
||||
if (dw->parent() != m_stackLayout)
|
||||
|
||||
Reference in New Issue
Block a user