diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index 92b8dba5b..d538773ee 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -1001,7 +1001,17 @@ void DockCorona::showAlternativesForApplet(Plasma::Applet *applet) return; } - KDeclarative::QmlObject *qmlObj = new KDeclarative::QmlObject(this); + DockView *dockView = m_dockViews[applet->containment()]; + + KDeclarative::QmlObject *qmlObj{nullptr}; + + if (dockView) { + dockView->setAlternativesIsShown(true); + qmlObj = new KDeclarative::QmlObject(dockView); + } else { + qmlObj = new KDeclarative::QmlObject(this); + } + qmlObj->setInitializationDelayed(true); qmlObj->setSource(QUrl::fromLocalFile(alternativesQML)); @@ -1011,12 +1021,7 @@ void DockCorona::showAlternativesForApplet(Plasma::Applet *applet) m_alternativesObjects << qmlObj; qmlObj->completeInitialization(); - DockView *dockView = m_dockViews[applet->containment()]; - - if (dockView) { - dockView->setAlternativesIsShown(true); - } - + //! Alternative dialog signals connect(helper, &QObject::destroyed, this, [dockView]() { dockView->setAlternativesIsShown(false); }); diff --git a/app/dockview.cpp b/app/dockview.cpp index 19d362a6f..b94eccf1d 100644 --- a/app/dockview.cpp +++ b/app/dockview.cpp @@ -1165,9 +1165,13 @@ void DockView::setBlockHiding(bool block) return; } - m_visibility->setBlockHiding(false); + if (m_visibility) { + m_visibility->setBlockHiding(false); + } } else { - m_visibility->setBlockHiding(true); + if (m_visibility) { + m_visibility->setBlockHiding(true); + } } }