From 523874dc210e41640986299d0b07c0fa6c6e76de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82?= <44851575+zneix@users.noreply.github.com> Date: Sat, 31 Oct 2020 16:17:09 +0100 Subject: [PATCH] Added tab navigation shortcut to SelectChannelDialog (#2142) Co-authored-by: Rasmus Karlsson --- src/widgets/dialogs/SelectChannelDialog.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/widgets/dialogs/SelectChannelDialog.cpp b/src/widgets/dialogs/SelectChannelDialog.cpp index a17c7022a..df786bade 100644 --- a/src/widgets/dialogs/SelectChannelDialog.cpp +++ b/src/widgets/dialogs/SelectChannelDialog.cpp @@ -4,6 +4,7 @@ #include "providers/twitch/TwitchIrcServer.hpp" #include "singletons/Theme.hpp" #include "util/LayoutCreator.hpp" +#include "util/Shortcut.hpp" #include "widgets/Notebook.hpp" #include "widgets/dialogs/IrcConnectionEditor.hpp" #include "widgets/helper/NotebookTab.hpp" @@ -213,17 +214,24 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent) this->ui_.twitch.channel->setFocus(); // Shortcuts - auto *shortcut_ok = new QShortcut(QKeySequence("Return"), this); - QObject::connect(shortcut_ok, &QShortcut::activated, [=] { this->ok(); }); - auto *shortcut_cancel = new QShortcut(QKeySequence("Esc"), this); - QObject::connect(shortcut_cancel, &QShortcut::activated, - [=] { this->close(); }); + createWindowShortcut(this, "Return", [=] { + this->ok(); // + }); + createWindowShortcut(this, "Esc", [=] { + this->close(); // + }); // restore ui state // fourtf: enable when releasing irc if (getSettings()->enableExperimentalIrc) { this->ui_.notebook->selectIndex(getSettings()->lastSelectChannelTab); + createWindowShortcut(this, "Ctrl+Tab", [=] { + this->ui_.notebook->selectNextTab(); // + }); + createWindowShortcut(this, "CTRL+Shift+Tab", [=] { + this->ui_.notebook->selectPreviousTab(); // + }); } this->ui_.irc.servers->getTableView()->selectRow(