mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Adding the possibility to close a tab by middle-clicking it.
This commit is contained in:
parent
d361c0631d
commit
73d11206ae
@ -230,3 +230,17 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
}
|
||||
QTabBar::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
void TabBar::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
TabWidget* tabWidget = qobject_cast<TabWidget*>(parentWidget());
|
||||
if (!tabWidget)
|
||||
return;
|
||||
|
||||
int id = tabAt(event->pos());
|
||||
if (id != -1 && event->buttons() == Qt::MiddleButton) {
|
||||
tabWidget->closeTab(id);
|
||||
return;
|
||||
}
|
||||
QTabBar::mousePressEvent(event);
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
QSize tabSizeHint(int index) const;
|
||||
// void tabInserted(int index);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user