mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
VerticalTabs: Fix tab switching with mouse wheel
Respect the "Always switch between tabs with mouse wheel" option. BUG: 394066 FIXED-IN: 24.12.0 Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
b1be34cd23
commit
ccce0818cc
@ -23,10 +23,12 @@
|
||||
#include "webtab.h"
|
||||
#include "tabcontextmenu.h"
|
||||
#include "browserwindow.h"
|
||||
#include "qzsettings.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QToolTip>
|
||||
#include <QHoverEvent>
|
||||
#include <QScrollBar>
|
||||
|
||||
TabTreeView::TabTreeView(BrowserWindow *window, QWidget *parent)
|
||||
: QTreeView(parent)
|
||||
@ -161,6 +163,10 @@ void TabTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bot
|
||||
|
||||
if (roles.size() == 1 && roles.at(0) == TabModel::CurrentTabRole && topLeft.data(TabModel::CurrentTabRole).toBool()) {
|
||||
setCurrentIndex(topLeft);
|
||||
|
||||
if (qzSettings->alwaysSwitchTabsWithWheel && verticalScrollBar()->isVisible()) {
|
||||
scrollTo(indexAbove(topLeft));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,6 +341,13 @@ bool TabTreeView::viewportEvent(QEvent *event)
|
||||
break;
|
||||
}
|
||||
|
||||
case QEvent::Wheel: {
|
||||
if (qzSettings->alwaysSwitchTabsWithWheel) {
|
||||
event->ignore();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "toolbutton.h"
|
||||
#include "tabtreemodel.h"
|
||||
#include "browserwindow.h"
|
||||
#include "qzsettings.h"
|
||||
|
||||
#include <QListView>
|
||||
#include <QScrollBar>
|
||||
@ -159,7 +160,7 @@ WebTab *VerticalTabsWidget::previousTab() const
|
||||
|
||||
void VerticalTabsWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (m_normalView->verticalScrollBar()->isVisible()) {
|
||||
if (!qzSettings->alwaysSwitchTabsWithWheel && m_normalView->verticalScrollBar()->isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user