Implement CTRL+1 to CTRL+9 hotkeys for switching tabs

Progress on #21
This commit is contained in:
Rasmus Karlsson
2018-01-06 20:27:26 +01:00
parent 8aa459d826
commit b8e268f969
4 changed files with 29 additions and 9 deletions
+17 -8
View File
@@ -3,6 +3,7 @@
#include "singletons/channelmanager.hpp"
#include "singletons/settingsmanager.hpp"
#include "singletons/thememanager.hpp"
#include "widgets/helper/shortcut.hpp"
#include "widgets/notebook.hpp"
#include "widgets/settingsdialog.hpp"
#include "widgets/split.hpp"
@@ -55,14 +56,22 @@ Window::Window(const QString &windowName, singletons::ThemeManager &_themeManage
this->loadGeometry();
// Initialize program-wide hotkeys
{
// CTRL+P: Open Settings Dialog
auto shortcut = new QShortcut(QKeySequence("CTRL+P"), this);
connect(shortcut, &QShortcut::activated, []() {
SettingsDialog::showDialog(); //
});
}
/// Initialize program-wide hotkeys
// CTRL+P: Open Settings Dialog
CreateShortcut(this, "CTRL+P", [] {
SettingsDialog::showDialog(); //
});
// CTRL+Number: Switch to n'th tab
CreateShortcut(this, "CTRL+1", [this] { this->notebook.selectIndex(0); });
CreateShortcut(this, "CTRL+2", [this] { this->notebook.selectIndex(1); });
CreateShortcut(this, "CTRL+3", [this] { this->notebook.selectIndex(2); });
CreateShortcut(this, "CTRL+4", [this] { this->notebook.selectIndex(3); });
CreateShortcut(this, "CTRL+5", [this] { this->notebook.selectIndex(4); });
CreateShortcut(this, "CTRL+6", [this] { this->notebook.selectIndex(5); });
CreateShortcut(this, "CTRL+7", [this] { this->notebook.selectIndex(6); });
CreateShortcut(this, "CTRL+8", [this] { this->notebook.selectIndex(7); });
CreateShortcut(this, "CTRL+9", [this] { this->notebook.selectIndex(8); });
}
void Window::repaintVisibleChatWidgets(Channel *channel)