Commit ce61ed46 authored by Peter Mühlenpfordt's avatar Peter Mühlenpfordt

Fix squished toolbar buttons in fullscreen view mode

Summary:
In fullscreen view mode the sidebar splitter can be moved to the right
until the toolbar buttons are squished a bit.
This is caused by a missing layout connection which would propagate
the correct minimum size hints. Since the toolbar in view mode
overlaps the image view a standard layout is not usable here.
This patch sets a minimum size hint for the image view according to
the internal layout of the overlay toolbar width.

{F5690953}

Test Plan:
1. Open gwenview in fullscreen view mode
2. Move sidebar splitter to right just before collapsing
-> The buttons of the top toolbar should remain in original size

Checked to correctly adjust width while:
* Toggling status bar ({key F3})
* Toggling {nav Show thumbnails}
* Opening images with different length filenames (thumbnails off)

Reviewers: rkflx, ngraham, #gwenview

Reviewed By: rkflx

Differential Revision: https://phabricator.kde.org/D10458
parent 4a87ed95
......@@ -151,7 +151,7 @@ void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoH
mInformationLabel = new QLabel;
mInformationLabel->setWordWrap(true);
mInformationLabel->setContentsMargins(6, 0, 6, 0);
mInformationLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
mInformationLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
mInformationLabel->setAutoFillBackground(true);
mInformationLabelShadow = new ShadowFilter(mInformationLabel);
......@@ -323,7 +323,7 @@ void FullScreenContent::updateLayout()
layout->addWidget(mInformationLabel);
layout->addWidget(mRightToolBar);
mAutoHideContainer->setFixedHeight(mContent->sizeHint().height());
mAutoHideContainer->setFixedHeight(mToolBar->sizeHint().height());
// Shadows
mToolBarShadow->reset();
......
......@@ -48,6 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <lib/documentview/documentviewcontainer.h>
#include <lib/documentview/documentviewcontroller.h>
#include <lib/documentview/documentviewsynchronizer.h>
#include <lib/fullscreenbar.h>
#include <lib/gvdebug.h>
#include <lib/gwenviewconfig.h>
#include <lib/paintutils.h>
......@@ -569,6 +570,26 @@ QSize ViewMainPage::sizeHint() const
return QSize(400, 300);
}
QSize ViewMainPage::minimumSizeHint() const {
if (!layout()) {
return QSize();
}
QSize minimumSize = layout()->minimumSize();
if (window()->isFullScreen()) {
// Check minimum width of the overlay fullscreen bar
// since there is no layout link which could do this
const FullScreenBar* fullScreenBar = findChild<FullScreenBar*>();
if (fullScreenBar && fullScreenBar->layout()) {
const int fullScreenBarWidth = fullScreenBar->layout()->minimumSize().width();
if (fullScreenBarWidth > minimumSize.width()) {
minimumSize.setWidth(fullScreenBarWidth);
}
}
}
return minimumSize;
}
QUrl ViewMainPage::url() const
{
GV_RETURN_VALUE_IF_FAIL(d->currentView(), QUrl());
......
......@@ -73,6 +73,7 @@ public:
int statusBarHeight() const;
QSize sizeHint() const Q_DECL_OVERRIDE;
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
/**
* Returns the url of the current document, or an invalid url if unknown
......
Markdown is supported
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