KrViewer: reenforce QTabWidget shortcuts for tab switching
ClosedPublic

Authored by nmel on Feb 22 2018, 8:04 AM.

Details

Summary

FIXED: [ 195749 ] Ctrl+Tab don't switch over edited files
BUG: 195749

Ctrl+Tab and Ctrl+Shift+Tab are actually default QTabWidget shortcuts
that are implemented via keyPressEvent method. When editor is placed on
a tab, it intercepts the key presses for itself. This is why KrViewer
understands the shortcuts fine if all tabs are Lister or other read-only
tabs. If there are Editor tabs, you can switch between tabs normally until
you hit an Editor tab and then it acts as Tab and Shift+Tab correspondingly.

This change enforces the shortcuts through
KActionCollection::setDefaultShortcuts which take precedence over
the editor shortcuts.

Test Plan

Open various types of tabs in KrViewer including Editor tabs.
Switch over the tabs with the shortcuts, standard KDE shortcuts for tabs, mouse, etc.

Diff Detail

Repository
R167 Krusader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nmel requested review of this revision.Feb 22 2018, 8:04 AM
nmel created this revision.
martinkostolny accepted this revision.Feb 23 2018, 1:15 AM
martinkostolny added a subscriber: martinkostolny.

Thanks, Nikita, for making this work!

One note when testing the shortcuts. When switch tab shortcuts are at default (both for panel tabs and krviewer tabs), and also in System Settings' Standard Shortcuts, one can change tabs in panel by pressing ctrl+(pgup|pgdown)- But when trying to do the same in krviewer, it triggers 'ambiguous' dialog. I'm not sure why e.g. closing tabs (ctrl+w) doesn't suffer from this issue. Anyway this behaviour is the same with or without this patch, so this is just an informational side note :).

This revision is now accepted and ready to land.Feb 23 2018, 1:15 AM
nmel added a comment.Feb 23 2018, 6:02 AM

Thanks for testing, Martin!

Yes, I noticed the problem with the primary standard shortcuts but it was not obvious how to debug. I'm going to open another report about it, just for tracking.

This revision was automatically updated to reflect the committed changes.