Commit a94fe7dd authored by Felix Ernst's avatar Felix Ernst 🇺🇦 Committed by Nate Graham
Browse files

Add a "Fit" button to the status bar

![2021-10-25_17-42-52](/uploads/07657e3e17892c39c02b183743725b12/2021-10-25_17-42-52.mp4)

The zoom actions for "Fit", "Fill" and "100%" were recently moved
from status bar to a common popup also available on the status bar
in 2c829f4e.
There was some criticism of this change because users found it
unnecessarily cumbersome that they now needed an extra click to
invoke these common actions.

This commit re-adds a "Fit" button on the status bar. It is a
toggle button and unchecking it will switch to "100%".

There is some criticism that this commit doesn't also re-add the
"Fill" and "100%" buttons. I will explain my reasons for not
adding them but this doesn't reflect a reached consensus and can
therefore not be a final decision.

I am interested in merging this as it is anyway because nobody
was against adding a "Fit" button.

The reasons why this commit re-adds a "Fit" button but neither a
"Fill" nor "100%" button are as follows:

"Fit" is the default way to view an image in Gwenview. It allows
users to get the full picture which in many cases is the most
important way to view an image. Whenever any zoom changes were done
this button will allow to quickly jump back to seeing the whole
image.

Zooming to "100%" is considered to be a lot less useful in many
situations. 1. The zoom value is identical to Fit for images
smaller than the view area. 2. Because of the previous, having
both a "100%" and "Fit" button can be confusing because changing
between them does seemingly nothing even though having these
buttons side by side implies that it would. 3. For pictures made
with typical cameras/phones nowadays 100% zoom is very zoomed in
and not automatically any more useful than e.g. 50% zoom.
For these reasons no "100%" button is added by this commit.
However the "Fit" action always worked in a way that unchecking it
zooms to 100% so zooming to 100% is now also only one click away
even though no explicit "100%" button is added.

Concerning the "Fill" action: I didn't see a lot of comments of
people being bothered by its removal from the status bar. Using it
might be an aquired taste and there might be some people that
use it a lot but it doesn't seem like it is very popular currently.
Users are encouraged to add a "Fill" button to their personal
toolbar or to "scroll down" on the new ZoomComboBox.

BUG: 441447

FIXED-IN: 22.04

cc @ndavis, @ngraham
parent 6aba8e56
Pipeline #137313 passed with stage
in 2 minutes and 24 seconds
......@@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QAction>
#include <QHBoxLayout>
#include <QSlider>
#include <QToolButton>
// KF
// Local
......@@ -53,6 +54,7 @@ inline qreal zoomForSliderValue(int sliderValue)
struct ZoomWidgetPrivate {
ZoomWidget *q = nullptr;
QToolButton *mFitButton = nullptr;
ZoomSlider *mZoomSlider = nullptr;
ZoomComboBox *mZoomComboBox = nullptr;
QAction *mActualSizeAction = nullptr;
......@@ -80,6 +82,8 @@ ZoomWidget::ZoomWidget(QWidget *parent)
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
d->mFitButton = new QToolButton(this);
d->mZoomSlider = new ZoomSlider(this);
d->mZoomSlider->setMinimumWidth(150);
d->mZoomSlider->slider()->setSingleStep(int(PRECISION));
......@@ -93,6 +97,7 @@ ZoomWidget::ZoomWidget(QWidget *parent)
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(d->mFitButton);
layout->addWidget(d->mZoomSlider);
layout->addWidget(d->mZoomComboBox);
}
......@@ -104,6 +109,9 @@ ZoomWidget::~ZoomWidget()
void ZoomWidget::setActions(QAction *zoomToFitAction, QAction *actualSizeAction, QAction *zoomInAction, QAction *zoomOutAction, QAction *zoomToFillAction)
{
d->mFitButton->setDefaultAction(zoomToFitAction);
d->mFitButton->setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonTextOnly);
d->mZoomSlider->setZoomInAction(zoomInAction);
d->mZoomSlider->setZoomOutAction(zoomOutAction);
......
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