Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to sort groups using shortcut keys #6999

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/gui/group/GroupView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ GroupView::GroupView(Database* db, QWidget* parent)

new QShortcut(Qt::CTRL + Qt::Key_F10, this, SLOT(contextMenuShortcutPressed()), nullptr, Qt::WidgetShortcut);

// keyboard shortcuts to sort children of a group
auto shortcut = new QShortcut(Qt::CTRL + Qt::Key_Down, this);
connect(shortcut, &QShortcut::activated, this, [this]() { sortGroupRequested(false); });
pruthig marked this conversation as resolved.
Show resolved Hide resolved

shortcut = new QShortcut(Qt::CTRL + Qt::Key_Up, this);
connect(shortcut, &QShortcut::activated, this, [this]() { sortGroupRequested(true); });

modelReset();

setDragEnabled(true);
Expand All @@ -68,6 +75,11 @@ void GroupView::contextMenuShortcutPressed()
}
}

void GroupView::sortGroupRequested(bool reverse)
{
sortGroups(reverse);
}

void GroupView::changeDatabase(const QSharedPointer<Database>& newDb)
{
m_model->changeDatabase(newDb.data());
Expand Down
1 change: 1 addition & 0 deletions src/gui/group/GroupView.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private slots:
void syncExpandedState(const QModelIndex& parent, int start, int end);
void modelReset();
void contextMenuShortcutPressed();
void sortGroupRequested(bool reverse);

protected:
void dragMoveEvent(QDragMoveEvent* event) override;
Expand Down