Commit f44ed709 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Make the tool bar buttons accessible

This allows users to select and activate the tool bar buttons with the
keyboard using Tab and Space.

GnuPG-bug-id: 6026
parent 229211c7
......@@ -33,6 +33,7 @@
#include "utils/action_data.h"
#include "utils/filedialog.h"
#include "utils/clipboardmenu.h"
#include "utils/gui-helper.h"
#include "dialogs/updatenotification.h"
......@@ -49,6 +50,7 @@
#include <KMessageBox>
#include <KStandardGuiItem>
#include <KShortcutsDialog>
#include <KToolBar>
#include <KEditToolBar>
#include "kleopatra_debug.h"
#include <KConfigGroup>
......@@ -391,6 +393,21 @@ MainWindow::Private::Private(MainWindow *qq)
q->createGUI(QStringLiteral("kleopatra.rc"));
// make toolbar buttons accessible by keyboard
if (auto toolbar = q->findChild<KToolBar*>()) {
auto toolbarButtons = toolbar->findChildren<QToolButton*>();
for (auto b : toolbarButtons) {
b->setFocusPolicy(Qt::TabFocus);
}
// move toolbar and its child widgets before the central widget in the tab order;
// this is necessary to make Shift+Tab work as expected
forceSetTabOrder(q, toolbar);
auto toolbarChildren = toolbar->findChildren<QWidget*>();
std::for_each(std::rbegin(toolbarChildren), std::rend(toolbarChildren), [toolbar](auto w) {
forceSetTabOrder(toolbar, w);
});
}
q->setAcceptDrops(true);
// set default window size
......
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