Save the last overlayed size

We might want to restore it
This commit is contained in:
Sergio Martins
2020-12-18 21:32:55 +00:00
parent e6c89c0564
commit d1f48b0685
2 changed files with 25 additions and 0 deletions

View File

@@ -133,6 +133,7 @@ public:
bool m_updatingToggleAction = false;
bool m_updatingFloatAction = false;
bool m_isForceClosing = false;
QSize m_lastOverlayedSize = QSize(0, 0);
};
DockWidgetBase::DockWidgetBase(const QString &name, Options options)
@@ -517,6 +518,11 @@ bool DockWidgetBase::hasPreviousDockedLocation() const
return d->m_lastPositions.isValid();
}
QSize DockWidgetBase::lastOverlayedSize() const
{
return d->m_lastOverlayedSize;
}
FloatingWindow *DockWidgetBase::morphIntoFloatingWindow()
{
qCDebug(creation) << "DockWidget::morphIntoFloatingWindow() this=" << this
@@ -796,6 +802,19 @@ void DockWidgetBase::onHidden(bool spontaneous)
}
}
bool DockWidgetBase::onResize(QSize newSize)
{
if (isOverlayed()) {
if (auto frame = this->frame()) {
d->m_lastOverlayedSize = frame->QWidgetAdapter::size();
} else {
qWarning() << Q_FUNC_INFO << "Overlayed dock widget without frame shouldn't happen";
}
}
return QWidgetAdapter::onResize(newSize);
}
void DockWidgetBase::onCloseEvent(QCloseEvent *e)
{
e->accept(); // By default we accept, means DockWidget closes