Skip to content

Commit

Permalink
Sidebar overlays now maintain their size when toggled
Browse files Browse the repository at this point in the history
Fixes #155
  • Loading branch information
iamsergio committed Feb 6, 2021
1 parent ea48d52 commit 4c33cd6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
had manually reordered tabs (#154)
- Fixed crash when hosting a QQuickWidget (#150)
- Fixed CMake Visual Studio generator not working
- Sidebar overlays now maintain their size when toggled (#155)

* v1.2.1 (6 February 2021)
- Support for resizing dock widgets when they are in overlay/popup mode (autohide/sidebar feature)
Expand Down
6 changes: 3 additions & 3 deletions src/MainWindowBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MainWindowBase::Private

QRect rectForOverlay(Frame *, SideBarLocation) const;
SideBarLocation preferredSideBar(DockWidgetBase *) const;
void updateOverlayGeometry(QSize suggestedSize = {});
void updateOverlayGeometry(QSize suggestedSize);
void clearSideBars();

QString name;
Expand Down Expand Up @@ -367,7 +367,7 @@ void MainWindowBase::Private::updateOverlayGeometry(QSize suggestedSize)

Frame *frame = m_overlayedDockWidget->d->frame();

if (suggestedSize.isValid()) {
if (suggestedSize.isValid() && !suggestedSize.isEmpty()) {
// Let's try to honour the suggested overlay size
switch (sb->location()) {
case SideBarLocation::North: {
Expand Down Expand Up @@ -468,7 +468,7 @@ void MainWindowBase::overlayOnSideBar(DockWidgetBase *dw)
auto frame = Config::self().frameworkWidgetFactory()->createFrame(this, FrameOption_IsOverlayed);
d->m_overlayedDockWidget = dw;
frame->addWidget(dw);
d->updateOverlayGeometry();
d->updateOverlayGeometry(dw->d->lastPositions().lastOverlayedGeometry(sb->location()).size());

auto resizeHandler = new WidgetResizeHandler(true, frame);
resizeHandler->setAllowedResizeSides(d->allowedResizeSides(sb->location()));
Expand Down
2 changes: 1 addition & 1 deletion tests/tst_docks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5334,6 +5334,7 @@ void TestDocks::tst_overlayedGeometryIsSaved()
Frame *frame = dw1->dptr()->frame();
QVERIFY(frame->isOverlayed());
QCOMPARE(dw1->sideBarLocation(), SideBarLocation::North);
QVERIFY(frame->height() > 0);

const int newHeight = frame->height() + 300;
frame->setHeight(newHeight);
Expand All @@ -5342,7 +5343,6 @@ void TestDocks::tst_overlayedGeometryIsSaved()
m1->toggleOverlayOnSideBar(dw1);

frame = dw1->dptr()->frame();
QEXPECT_FAIL("", "Will fix", Continue);
QCOMPARE(frame->height(), newHeight);
}

Expand Down

0 comments on commit 4c33cd6

Please sign in to comment.