1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[TabBar] Added option to always switch tabs using mouse wheel

It will switch tabs even when tabs are overflowing.
This commit is contained in:
nowrep 2014-01-12 16:39:23 +01:00
parent bfe9331579
commit 7cb39aed0b
5 changed files with 18 additions and 0 deletions

View File

@ -57,6 +57,7 @@ void QzSettings::loadSettings()
settings.beginGroup("Browser-Tabs-Settings");
newTabPosition = settings.value("OpenNewTabsSelected", false).toBool() ? Qz::NT_SelectedTab : Qz::NT_NotSelectedTab;
tabsOnTop = settings.value("TabsOnTop", false).toBool();
alwaysSwitchTabsWithWheel = settings.value("AlwaysSwitchTabsWithWheel", false).toBool();
settings.endGroup();
}

View File

@ -60,6 +60,7 @@ public:
// Browser-Tabs-Settings
Qz::NewTabPositionFlag newTabPosition;
bool tabsOnTop;
bool alwaysSwitchTabsWithWheel;
};
#define qzSettings Settings::staticSettings()

View File

@ -228,6 +228,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
ui->openNewTabAfterActive->setChecked(settings.value("newTabAfterActive", true).toBool());
ui->openNewEmptyTabAfterActive->setChecked(settings.value("newEmptyTabAfterActive", false).toBool());
ui->alwaysSwitchTabsWithWheel->setChecked(settings.value("AlwaysSwitchTabsWithWheel", false).toBool());
ui->switchToNewTabs->setChecked(settings.value("OpenNewTabsSelected", false).toBool());
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
@ -901,6 +902,7 @@ void Preferences::saveSettings()
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
settings.setValue("newTabAfterActive", ui->openNewTabAfterActive->isChecked());
settings.setValue("newEmptyTabAfterActive", ui->openNewEmptyTabAfterActive->isChecked());
settings.setValue("AlwaysSwitchTabsWithWheel", ui->alwaysSwitchTabsWithWheel->isChecked());
settings.setValue("OpenNewTabsSelected", ui->switchToNewTabs->isChecked());
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());

View File

@ -728,6 +728,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="alwaysSwitchTabsWithWheel">
<property name="text">
<string>Always switch between tabs with mouse wheel</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="switchToNewTabs">
<property name="text">

View File

@ -19,6 +19,7 @@
#include "toolbutton.h"
#include "mainapplication.h"
#include "proxystyle.h"
#include "qzsettings.h"
#include <QIcon>
#include <QHBoxLayout>
@ -535,6 +536,12 @@ int ComboTabBar::pinTabBarWidth() const
void ComboTabBar::wheelEvent(QWheelEvent* event)
{
event->accept();
if (qzSettings->alwaysSwitchTabsWithWheel) {
setCurrentNextEnabledIndex(event->delta() > 0 ? -1 : 1);
return;
}
if (m_mainTabBarWidget->underMouse()) {
if (m_mainTabBarWidget->scrollBar()->isOverFlowed()) {
m_mainTabBarWidget->scrollByWheel(event);