Debian Codegraph @

src/librssguard/gui/reusable/basetreeview.cpp

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.
2
3 #include "gui/reusable/basetreeview.h"
4
5 #include "miscellaneous/application.h"
6 #include "miscellaneous/settings.h"
7
8 #include <QKeyEvent>
9
10 BaseTreeView::BaseTreeView(QWidget* parent) : QTreeView(parent) {
11 m_allowedKeyboardKeys = {Qt::Key::Key_Back,
12 Qt::Key::Key_Select,
13 Qt::Key::Key_Copy,
14 Qt::Key::Key_Shift,
15 Qt::Key::Key_Control,
16 Qt::Key::Key_Up,
17 Qt::Key::Key_Down,
18 Qt::Key::Key_Left,
19 Qt::Key::Key_Right,
20 Qt::Key::Key_Home,
21 Qt::Key::Key_End,
22 Qt::Key::Key_PageUp,
23 Qt::Key::Key_PageDown};
24 }
25
26 bool BaseTreeView::isIndexHidden(const QModelIndex& idx) const {
27 return QTreeView::isIndexHidden(idx);
28 }
29
30 void BaseTreeView::keyPressEvent(QKeyEvent* event) {
31 if (qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::OnlyBasicShortcutsInLists)).toBool() &&
32 !m_allowedKeyboardKeys.contains(event->key()) && !event->matches(QKeySequence::StandardKey::SelectAll)) {
33 event->ignore();
34 }
35 else {
36 QTreeView::keyPressEvent(event);
37 }
38 }