diff --git a/src/dquickwindow.cpp b/src/dquickwindow.cpp index 822e15fd..4018cce6 100644 --- a/src/dquickwindow.cpp +++ b/src/dquickwindow.cpp @@ -190,6 +190,12 @@ void DQuickWindowAttachedPrivate::_q_updateClipPath() q->setClipPathByWM(clipPath->path()); } +void DQuickWindowAttachedPrivate::_q_ensurePlatformHandle() +{ + if (explicitEnable && DWindowManagerHelper::instance()->hasNoTitlebar()) + ensurePlatformHandle(); +} + DQuickWindowAttached::DQuickWindowAttached(QWindow *window) : QObject(window) , DObject(*new DQuickWindowAttachedPrivate(window, this)) @@ -490,13 +496,8 @@ void DQuickWindowAttached::setEnabled(bool e) } if (!d->ensurePlatformHandle()) { - QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasNoTitlebarChanged, this, - [this] () { - D_D(DQuickWindowAttached); - if (d->explicitEnable && DWindowManagerHelper::instance()->hasNoTitlebar()) - d->ensurePlatformHandle(); - - }, Qt::UniqueConnection); + QObject::connect(DWindowManagerHelper::instance(), SIGNAL(hasNoTitlebarChanged()), this, SLOT(_q_ensurePlatformHandle()) + , Qt::UniqueConnection); } } diff --git a/src/dquickwindow.h b/src/dquickwindow.h index 2e7b9e77..0b363c60 100644 --- a/src/dquickwindow.h +++ b/src/dquickwindow.h @@ -168,6 +168,7 @@ public Q_SLOTS: D_PRIVATE_SLOT(void _q_onWindowMotifHintsChanged(quint32)) D_PRIVATE_SLOT(void _q_updateBlurAreaForWindow()) D_PRIVATE_SLOT(void _q_updateClipPath()) + D_PRIVATE_SLOT(void _q_ensurePlatformHandle()) friend class DQuickBehindWindowBlur; friend class DQuickBehindWindowBlurPrivate; diff --git a/src/private/dquickwindow_p.h b/src/private/dquickwindow_p.h index c1c765ad..54204adb 100644 --- a/src/private/dquickwindow_p.h +++ b/src/private/dquickwindow_p.h @@ -39,6 +39,7 @@ class DQuickWindowAttachedPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate void updateBlurAreaFor(DQuickBehindWindowBlur *blur); void _q_updateBlurAreaForWindow(); void _q_updateClipPath(); + void _q_ensurePlatformHandle(); QWindow *window = nullptr; DPlatformHandle *handle = nullptr;