From b4789ee4b528942f171cd2b66dd47c75b866aa69 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 11 Sep 2017 17:16:53 +0200 Subject: Removed Settings::contains --- src/widgets/webviewtabbar.cpp | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'src/widgets/webviewtabbar.cpp') 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 #include +#include + 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))); -- cgit v1.2.1