aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow')
-rw-r--r--src/mainwindow/widgets/tabwidget.cpp14
-rw-r--r--src/mainwindow/widgets/tabwidget.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/mainwindow/widgets/tabwidget.cpp b/src/mainwindow/widgets/tabwidget.cpp
index 48a1cfb..2858fb0 100644
--- a/src/mainwindow/widgets/tabwidget.cpp
+++ b/src/mainwindow/widgets/tabwidget.cpp
@@ -123,3 +123,17 @@ void TabWidget::contextMenuEvent(QContextMenuEvent *event)
tabContextMenu->exec(event->globalPos());
}
+
+void TabWidget::mousePressEvent(QMouseEvent *event)
+{
+ if(event->button() == Qt::MiddleButton) {
+ int index = tabBar()->tabAt(event->pos());
+ if(index >= 0) {
+ deleteTab(index);
+ }
+ event->accept();
+ return;
+ }
+
+ QTabWidget::mousePressEvent(event);
+}
diff --git a/src/mainwindow/widgets/tabwidget.h b/src/mainwindow/widgets/tabwidget.h
index 06fa79b..793e041 100644
--- a/src/mainwindow/widgets/tabwidget.h
+++ b/src/mainwindow/widgets/tabwidget.h
@@ -28,6 +28,7 @@ public slots:
protected:
void contextMenuEvent(QContextMenuEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
private:
QMenu *tabContextMenu;