aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/webviewtabbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/webviewtabbar.cpp')
-rw-r--r--src/widgets/webviewtabbar.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp
index 7ec7f0b..9264a2a 100644
--- a/src/widgets/webviewtabbar.cpp
+++ b/src/widgets/webviewtabbar.cpp
@@ -24,6 +24,8 @@
#include <QContextMenuEvent>
#include <QMenu>
+#include <QShortcut>
+
WebViewTabBar::WebViewTabBar(WebEngineProfile *profile, QWidget *parent) :
QTabBar(parent)
{
@@ -37,30 +39,23 @@ WebViewTabBar::WebViewTabBar(WebEngineProfile *profile, QWidget *parent) :
connect(this, SIGNAL(currentChanged(int)), this, SLOT(handleCurrentChanged(int)));
connect(this, SIGNAL(tabMoved(int,int)), this, SLOT(updateVectorArrangement(int,int)));
- if(sSettings->contains("window.shortcuts.tabClose")) {
- QAction *tabCloseAction = new QAction(this);
- tabCloseAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabClose").toString()));
- connect(tabCloseAction, &QAction::triggered, [this]() {
- this->removeTab(currentIndex());
- });
- addAction(tabCloseAction);
- }
- if(sSettings->contains("window.shortcuts.tabLeft")) {
- QAction *tabLeftAction = new QAction(this);
- tabLeftAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabLeft").toString()));
- connect(tabLeftAction, &QAction::triggered, [this]() {
- this->setCurrentIndex(currentIndex()-1);
- });
- addAction(tabLeftAction);
- }
- if(sSettings->contains("window.shortcuts.tabRight")) {
- QAction *tabRightAction = new QAction(this);
- tabRightAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabRight").toString()));
- connect(tabRightAction, &QAction::triggered, [this]() {
- this->setCurrentIndex(currentIndex()+1);
- });
- addAction(tabRightAction);
- }
+ QShortcut *tabCloseShortcut = new QShortcut(this);
+ tabCloseShortcut->setKey(QKeySequence::fromString(qApp->settings()->value("window.shortcuts.tabClose").toString()));
+ connect(tabCloseShortcut, &QShortcut::activated, [this]() {
+ this->removeTab(currentIndex());
+ });
+
+ QShortcut *tabLeftShortcut = new QShortcut(this);
+ tabLeftShortcut->setKey(QKeySequence::fromString(qApp->settings()->value("window.shortcuts.tabLeft").toString()));
+ connect(tabLeftShortcut, &QShortcut::activated, [this]() {
+ this->setCurrentIndex(currentIndex()-1);
+ });
+
+ QShortcut *tabRightShortcut = new QShortcut(this);
+ tabRightShortcut->setKey(QKeySequence::fromString(qApp->settings()->value("window.shortcuts.tabRight").toString()));
+ connect(tabRightShortcut, &QShortcut::activated, [this]() {
+ this->setCurrentIndex(currentIndex()+1);
+ });
m_signalMapper = new QSignalMapper(this);
connect(m_signalMapper, SIGNAL(mapped(int)), this, SLOT(webAction(int)));