┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphintabbar.cpp
diff options
context:
space:
mode:
authorarnav dhamija <[email protected]>2017-02-13 22:23:41 +0530
committerarnav dhamija <[email protected]>2017-02-13 22:23:41 +0530
commit41253c0c81bafb54a0b6c82e5282e3add85e8a50 (patch)
tree9a5ccfbade73ee481884ac53aa7e2fe724f25272 /src/dolphintabbar.cpp
parent67099640b90588af1c72c340756253400da3e95b (diff)
parent7fce8f0e9b1e0bb2deb6e32fe88d5411b9be2834 (diff)
Merge branch 'master' of git.kde.org:dolphin
Diffstat (limited to 'src/dolphintabbar.cpp')
-rw-r--r--src/dolphintabbar.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp
index e909c36ae..484a9f3a0 100644
--- a/src/dolphintabbar.cpp
+++ b/src/dolphintabbar.cpp
@@ -29,7 +29,8 @@
DolphinTabBar::DolphinTabBar(QWidget* parent) :
QTabBar(parent),
- m_autoActivationIndex(-1)
+ m_autoActivationIndex(-1),
+ m_tabToBeClosedOnMiddleMouseButtonRelease(-1)
{
setAcceptDrops(true);
setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
@@ -95,12 +96,25 @@ void DolphinTabBar::mousePressEvent(QMouseEvent* event)
const int index = tabAt(event->pos());
if (index >= 0 && event->button() == Qt::MiddleButton) {
+ m_tabToBeClosedOnMiddleMouseButtonRelease = index;
+ return;
+ }
+
+ QTabBar::mousePressEvent(event);
+}
+
+void DolphinTabBar::mouseReleaseEvent(QMouseEvent *event)
+{
+ const int index = tabAt(event->pos());
+
+ if (index >= 0 && index == m_tabToBeClosedOnMiddleMouseButtonRelease
+ && event->button() == Qt::MiddleButton) {
// Mouse middle click on a tab closes this tab.
emit tabCloseRequested(index);
return;
}
- QTabBar::mousePressEvent(event);
+ QTabBar::mouseReleaseEvent(event);
}
void DolphinTabBar::mouseDoubleClickEvent(QMouseEvent* event)