diff --git a/src/blackgui/dockwidget.cpp b/src/blackgui/dockwidget.cpp index afbb700a5..20d009a76 100644 --- a/src/blackgui/dockwidget.cpp +++ b/src/blackgui/dockwidget.cpp @@ -280,6 +280,15 @@ namespace BlackGui this->setFrameless(!frameless); } + void CDockWidget::toggleFramelessDeferred(int delayMs) + { + QPointer myself(this); + QTimer::singleShot(delayMs, this, [ = ] + { + if (myself) { myself->toggleFrameless(); } + }); + } + void CDockWidget::windowAlwaysOnTop() { if (this->isFloating()) @@ -317,16 +326,17 @@ namespace BlackGui { this->toggleFloating(); } - if (s.isFramless() != this->isFrameless()) - { - this->toggleFrameless(); - } const QByteArray geo(s.getGeometry()); if (!geo.isEmpty()) { const bool ok = this->restoreGeometry(geo); if (ok) { this->rememberFloatingSizeAndPosition(); } } + if (s.isFramless() != this->isFrameless()) + { + // not working if directly called + this->toggleFramelessDeferred(); + } this->setMargins(); return true; } diff --git a/src/blackgui/dockwidget.h b/src/blackgui/dockwidget.h index ab69f5c52..f3ac94dd1 100644 --- a/src/blackgui/dockwidget.h +++ b/src/blackgui/dockwidget.h @@ -108,6 +108,9 @@ namespace BlackGui //! Toggle frameless mode void toggleFrameless(); + //! Toggle frameless deferred + void toggleFramelessDeferred(int delayMs = 1000); + //! Window always on top void windowAlwaysOnTop();