aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/subwindow/tabwidget.cpp7
-rw-r--r--src/subwindow/tabwidget.h4
2 files changed, 9 insertions, 2 deletions
diff --git a/src/subwindow/tabwidget.cpp b/src/subwindow/tabwidget.cpp
index 6951b7b..ef15657 100644
--- a/src/subwindow/tabwidget.cpp
+++ b/src/subwindow/tabwidget.cpp
@@ -67,6 +67,12 @@ TabWidget::TabWidget(QWidget *parent)
removeTab(i);
}
});
+
+ //
+ connect(this, &TabWidget::currentChanged, this, [this](int index) {
+ previous = current;
+ current = index;
+ });
}
TabWidget::~TabWidget()
@@ -117,6 +123,7 @@ void TabWidget::removeTab(int index)
m_closedTabs.dequeue();
}
+ setCurrentIndex(previous);
QTabWidget::removeTab(index);
delete w;
}
diff --git a/src/subwindow/tabwidget.h b/src/subwindow/tabwidget.h
index d615bcb..d67d2de 100644
--- a/src/subwindow/tabwidget.h
+++ b/src/subwindow/tabwidget.h
@@ -45,9 +45,9 @@ protected:
void contextMenuEvent(QContextMenuEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
-
-
private:
+ int current = -1;
+ int previous = -1;
QMenu *tabContextMenu;
QQueue<TabInformation> m_closedTabs;
};