From 866bf996cf6aec383cf6cdfa4a2ab8ce7eb2f721 Mon Sep 17 00:00:00 2001 From: glubsy Date: Sat, 1 Aug 2020 19:35:12 +0200 Subject: [PATCH] Prevent Directories tab from closing on MacOS * The close button on custom tabs cannot be hidden on MacOS for some reason. * Prevent the directories tab from closing if the close button was clicked by mistake --- qt/tabbed_window.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qt/tabbed_window.py b/qt/tabbed_window.py index 83f1c5c8..30f004ec 100644 --- a/qt/tabbed_window.py +++ b/qt/tabbed_window.py @@ -344,6 +344,11 @@ class TabBarWindow(TabWindow): @pyqtSlot(int) def onTabCloseRequested(self, index): current_widget = self.getWidgetAtIndex(index) + if isinstance(current_widget, DirectoriesDialog): + # On MacOS, the tab has a close button even though we explicitely + # set it to None in order to hide it. This should prevent + # the "Directories" tab from closing by mistake. + return current_widget.close() self.stackedWidget.removeWidget(current_widget) # In this case the signal will take care of the tab itself after removing the widget