Close viewer tabs with middle click
ClosedPublic

Authored by gengisdave on May 6 2020, 9:33 PM.

Details

Reviewers
yurchor
asensi
Group Reviewers
Krusader
Summary

This patch adds an option to close a Viewer tab using the middle mouse click.

This could lead to handle a popup menu on the Viewer tab.

FIXED: [ 228461 ] KrViewer - Middle mouse button to close tabs in default settings
BUG: 228461

Test Plan

Compile and test using different Kparts.

Diff Detail

Repository
R167 Krusader
Lint
Lint Skipped
Unit
Unit Tests Skipped
gengisdave requested review of this revision.May 6 2020, 9:33 PM
gengisdave created this revision.
yurchor accepted this revision as: yurchor.May 7 2020, 1:18 PM
yurchor added a subscriber: yurchor.

Tested to work as expected. Thanks.

This revision is now accepted and ready to land.May 7 2020, 1:18 PM
asensi accepted this revision as: asensi.May 9 2020, 6:19 PM
asensi added a subscriber: asensi.

Thank you, Davide, for those important changes!

And thanks, Yuri, for testing!

krusader/KViewer/krviewer.cpp
81

What about using:
tabBar = qobject_cast<ViewerTabBar *>(tabWidget.tabBar());
?

In theory, qobject_cast is better in those cases (https://stackoverflow.com/questions/43994584/what-is-qobject-cast , https://doc.qt.io/qt-5/qobject.html#qobject_cast)

krusader/KViewer/viewertabbar.cpp
27

Using the style of other places of the source code, it would be:

ViewerTabWidget::ViewerTabWidget(QWidget *parent) : QTabWidget(parent)

with a space before the :, though it's not so important :-)

36

Using the style of other places of the source code, those lines would not be there, and in the header file the

ViewerTabBar(QWidget *parent);

would be a:

explicit ViewerTabBar(QWidget *parent) : QTabBar(parent) {}

though it's not so important (well, the explicit can avoid some possible errors) :-)

krusader/KViewer/viewertabbar.h
36

What about using an explicit in order to avoid some possible errors?

explicit ViewerTabWidget(QWidget *parent);

:-?

52

Using the style of other places of the source code, it would be:

void mousePressEvent(QMouseEvent *) override;

with a space before the *, though it's not so important :-)

56

What about using

emitted when the user mid-clicks on the tab

with an s, although we know it's not so important :-)

gengisdave marked 6 inline comments as done.

Updating revision with suggestions