Commit b3e66abe authored by Peter Mühlenpfordt's avatar Peter Mühlenpfordt
Browse files

Resize top bar in fullscreen view mode on toggling sidebar

Summary:
When viewing an image in fullscreen mode and pressing {key F4} to
toggle the sidebar, the toolbar at the top does not resize.
The buttons on the right side are not visible while sidebar shows.
In browse mode `KToolBar` is used with a standard layout where this
problem does not appear. Since the toolbar in view mode overlaps the
image view a standard layout is not usable here which would send
resize events automatically.
This patch adds a resize Eventlistener to adjust toolbar width.

BUG: 387784

Test Plan:
1. Open gwenview in fullscreen view mode
2. Toggle sidebar ({key F4})
-> The top toolbar should resize according to image view width

Checked to work properly on a second monitor.

Reviewers: rkflx, ngraham

Reviewed By: rkflx

Differential Revision: https://phabricator.kde.org/D10248
parent c1262d57
......@@ -120,6 +120,8 @@ void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoH
layout->setMargin(0);
layout->setSpacing(0);
EventWatcher::install(autoHideParentWidget, QEvent::Resize, this, SLOT(adjustSize()));
// mContent
mContent = new QWidget;
mContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
......@@ -349,6 +351,12 @@ void FullScreenContent::updateContainerAppearance()
mAutoHideContainer->setActivated(true);
}
void FullScreenContent::adjustSize()
{
if (mFullScreenMode && mViewPageVisible) {
mAutoHideContainer->adjustSize();
}
}
void FullScreenContent::createOptionsAction()
{
......
......@@ -92,6 +92,7 @@ private Q_SLOTS:
void setFullScreenBarHeight(int value);
void slotShowThumbnailsToggled(bool value);
void slotViewModeActionToggled(bool value);
void adjustSize();
private:
KActionCollection* mActionCollection;
......
......@@ -147,8 +147,7 @@ QSize FullScreenBar::sizeHint() const
}
if (layout()->expandingDirections() & Qt::Horizontal) {
int width = QApplication::desktop()->screenGeometry(window()).width();
sh.setWidth(width);
sh.setWidth(parentWidget()->width());
}
return sh;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment