mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add hotkey for group switching (#10625)
* Add hotkey for group switching Ctrl + Shift + Key_PageUp for previous group Ctrl + Shift + Key_PageDown for next group Fixes #4394
This commit is contained in:
parent
7ae65dd656
commit
4ef52c859b
@ -44,6 +44,9 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
||||
// clang-format on
|
||||
|
||||
new QShortcut(Qt::CTRL + Qt::Key_F10, this, SLOT(contextMenuShortcutPressed()), nullptr, Qt::WidgetShortcut);
|
||||
new QShortcut(
|
||||
Qt::CTRL + Qt::SHIFT + Qt::Key_PageUp, this, SLOT(selectPreviousGroup()), nullptr, Qt::WindowShortcut);
|
||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_PageDown, this, SLOT(selectNextGroup()), nullptr, Qt::WindowShortcut);
|
||||
|
||||
// keyboard shortcuts to sort children of a group
|
||||
auto shortcut = new QShortcut(Qt::CTRL + Qt::Key_Down, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||
@ -60,6 +63,24 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
||||
setDefaultDropAction(Qt::MoveAction);
|
||||
}
|
||||
|
||||
void GroupView::selectPreviousGroup()
|
||||
{
|
||||
auto previousIndex = indexAbove(currentIndex());
|
||||
if (previousIndex.isValid()) {
|
||||
auto previousGroup = m_model->groupFromIndex(previousIndex);
|
||||
setCurrentGroup(previousGroup);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupView::selectNextGroup()
|
||||
{
|
||||
auto nextIndex = indexBelow(currentIndex());
|
||||
if (nextIndex.isValid()) {
|
||||
auto nextGroup = m_model->groupFromIndex(nextIndex);
|
||||
setCurrentGroup(nextGroup);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupView::contextMenuShortcutPressed()
|
||||
{
|
||||
auto index = currentIndex();
|
||||
|
@ -46,6 +46,8 @@ private slots:
|
||||
void syncExpandedState(const QModelIndex& parent, int start, int end);
|
||||
void modelReset();
|
||||
void contextMenuShortcutPressed();
|
||||
void selectPreviousGroup();
|
||||
void selectNextGroup();
|
||||
|
||||
protected:
|
||||
void dragMoveEvent(QDragMoveEvent* event) override;
|
||||
|
Loading…
Reference in New Issue
Block a user