1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Adding the possibility to close a tab by middle-clicking it.

This commit is contained in:
Daniele Cocca 2011-10-14 23:32:12 +02:00
parent d361c0631d
commit 73d11206ae
2 changed files with 15 additions and 0 deletions

View File

@ -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);
}

View File

@ -70,6 +70,7 @@ private slots:
private:
void mouseDoubleClickEvent(QMouseEvent* event);
void mousePressEvent(QMouseEvent* event);
QSize tabSizeHint(int index) const;
// void tabInserted(int index);