Don't save last position if the window was hidden already

Bug was happening when calling close() an closed dock widget, it
would then save the position of the invisible window. Next time it
was open it would appear in a bogus location. 0,0 in my case.
This commit is contained in:
Sergio Martins
2020-02-06 15:01:58 +00:00
parent fca010ce2a
commit aded290573
2 changed files with 14 additions and 1 deletions

View File

@@ -455,7 +455,8 @@ TabWidget *DockWidgetBase::Private::parentTabWidget() const
void DockWidgetBase::Private::close()
{
if (!m_isForceClosing && q->isFloating()) { // only user-closing is interesting to save the geometry
if (!m_isForceClosing && q->isFloating() && q->isVisible()) { // only user-closing is interesting to save the geometry
// We check for isVisible so we don't save geometry if you call close() on an already closed dock widget
m_lastPosition.setLastFloatingGeometry(q->window()->geometry());
}