Commit 924a5fb9 authored by Albert Astals Cid's avatar Albert Astals Cid

Fix middle click on sidebar tab bar unloads the document.

Filter the exact widget we care about for middle mouse buttons

BUGS: 426613
parent af526819
Pipeline #38804 passed with stage
in 55 minutes and 29 seconds
......@@ -106,7 +106,7 @@ Shell::Shell(const QString &serializedOptions)
m_tabWidget->setMovable(true);
m_tabWidget->setAcceptDrops(true);
m_tabWidget->installEventFilter(this);
m_tabWidget->tabBar()->installEventFilter(this);
connect(m_tabWidget, &QTabWidget::currentChanged, this, &Shell::setActiveTab);
connect(m_tabWidget, &QTabWidget::tabCloseRequested, this, &Shell::closeTab);
......@@ -149,8 +149,6 @@ Shell::Shell(const QString &serializedOptions)
bool Shell::eventFilter(QObject *obj, QEvent *event)
{
Q_UNUSED(obj);
QDragMoveEvent *dmEvent = dynamic_cast<QDragMoveEvent *>(event);
if (dmEvent) {
bool accept = dmEvent->mimeData()->hasUrls();
......@@ -167,7 +165,7 @@ bool Shell::eventFilter(QObject *obj, QEvent *event)
}
// Handle middle button click events on the tab bar
if (obj == m_tabWidget && event->type() == QEvent::MouseButtonRelease) {
if (obj == m_tabWidget->tabBar() && event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *mEvent = static_cast<QMouseEvent *>(event);
if (mEvent->button() == Qt::MiddleButton) {
int tabIndex = m_tabWidget->tabBar()->tabAt(mEvent->pos());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment