Shrink the overlay popup when we shrink the main window
Should be enough for issue #118
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
- [TODO] QtQuick support
|
||||
|
||||
* v1.2.1 (unreleased)
|
||||
-
|
||||
- Support for resizing dock widgets when they are in overlay/popup mode (autohide/sidebar feature)
|
||||
|
||||
* v1.2.0 (17 December 2020)
|
||||
- Wayland support
|
||||
|
||||
@@ -364,19 +364,35 @@ void MainWindowBase::Private::updateOverlayGeometry(bool reusePreviousSize)
|
||||
|
||||
Frame *frame = m_overlayedDockWidget->frame();
|
||||
|
||||
if (reusePreviousSize) {
|
||||
if (reusePreviousSize) {
|
||||
// Let's try to honour the previous overlay size
|
||||
switch (sb->location()) {
|
||||
case SideBarLocation::North:
|
||||
case SideBarLocation::South:
|
||||
newGeometry.setHeight(frame->height());
|
||||
case SideBarLocation::North: {
|
||||
const int maxHeight = q->height() - frame->pos().y() - 10; // gap
|
||||
newGeometry.setHeight(qMin(frame->height(), maxHeight));
|
||||
break;
|
||||
case SideBarLocation::East:
|
||||
case SideBarLocation::West:
|
||||
newGeometry.setHeight(frame->width());
|
||||
}
|
||||
case SideBarLocation::South: {
|
||||
const int maxHeight = sb->pos().y() - m_dropArea->pos().y() - 10; // gap
|
||||
const int bottom = newGeometry.bottom();
|
||||
newGeometry.setHeight(qMin(frame->height(), maxHeight));
|
||||
newGeometry.moveBottom(bottom);
|
||||
break;
|
||||
|
||||
}
|
||||
case SideBarLocation::East: {
|
||||
const int maxWidth = sb->pos().x() - m_dropArea->pos().x() - 10; // gap
|
||||
const int right = newGeometry.right();
|
||||
newGeometry.setWidth(qMin(frame->width(), maxWidth));
|
||||
newGeometry.moveRight(right);
|
||||
break;
|
||||
}
|
||||
case SideBarLocation::West: {
|
||||
const int maxWidth = q->width() - frame->pos().x() - 10; // gap
|
||||
newGeometry.setWidth(qMin(frame->height(), maxWidth));
|
||||
break;
|
||||
}
|
||||
case SideBarLocation::None:
|
||||
qWarning() << Q_FUNC_INFO << "Unexpected sidebar value";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user