Restore dock widget from settings, fixed frameless widget restore

https://discordapp.com/channels/539048679160676382/539486309882789888/593835010566521033
This commit is contained in:
Klaus Basan
2019-06-28 01:30:31 +02:00
committed by Mat Sutcliffe
parent 66f19b29be
commit 49d1bcbd39
2 changed files with 17 additions and 4 deletions

View File

@@ -280,6 +280,15 @@ namespace BlackGui
this->setFrameless(!frameless);
}
void CDockWidget::toggleFramelessDeferred(int delayMs)
{
QPointer<CDockWidget> 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;
}

View File

@@ -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();