From 900af55be02b59fdbd674b048bfb121f527b495e Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 9 Dec 2020 23:28:08 +0200 Subject: [PATCH] - in Tcl Shell Dock widget make sure that the context menu is not shown on the title bar and middle clicking on the title bar will close the widget --- CHANGELOG.md | 1 + appGUI/GUIElements.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cace4801..3d993c92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ CHANGELOG for FlatCAM beta - Drilling Tool - remade the 'Beginner/Advanced' Mode - Milling Tool - fixed the ever-growing list of preprocessor's - in all Object UI's fixed the Properties section columns resize to content on expansion/collapse of the items +- in Tcl Shell Dock widget make sure that the context menu is not shown on the title bar and middle clicking on the title bar will close the widget 8.12.2020 diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index c609c786..9c5b3299 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -4292,6 +4292,15 @@ class FCDock(QtWidgets.QDockWidget): super(FCDock, self).__init__(*args) self.close_callback = kwargs["close_callback"] if "close_callback" in kwargs else None + self.setContextMenuPolicy(Qt.PreventContextMenu) + + def mousePressEvent(self, event: QtGui.QMouseEvent) -> None: + if event.button() == Qt.MiddleButton: + try: + self.close_callback() + except Exception: + pass + def closeEvent(self, event: QtGui.QCloseEvent) -> None: self.close_callback() super().closeEvent(event)