mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-10 08:18:15 +03:00
Added "Close" button in some widget toolbar.
This add supports for window closing where there is no traffic light control for "WindowModal" on macOS Signed-off-by: LorenEteval <loren.eteval@proton.me>
This commit is contained in:
committed by
Loren Eteval
parent
bc50fa5a8b
commit
890d7a559d
@@ -76,21 +76,7 @@ class TextEditorWindow(AppQMainWindow):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.customWindowTitle = ''
|
||||
|
||||
if PLATFORM == 'Darwin':
|
||||
# Window-modal child windows are rendered as macOS sheets
|
||||
# without traffic-light controls.
|
||||
self.setWindowFlags(
|
||||
self.windowFlags()
|
||||
| QtCore.Qt.WindowType.Window
|
||||
| QtCore.Qt.WindowType.WindowTitleHint
|
||||
| QtCore.Qt.WindowType.WindowSystemMenuHint
|
||||
| QtCore.Qt.WindowType.WindowMinimizeButtonHint
|
||||
| QtCore.Qt.WindowType.WindowCloseButtonHint
|
||||
)
|
||||
self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
|
||||
else:
|
||||
self.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
|
||||
self.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
|
||||
|
||||
self.setFixedSize(450, int(450 * GOLDEN_RATIO))
|
||||
|
||||
@@ -121,6 +107,18 @@ class TextEditorWindow(AppQMainWindow):
|
||||
|
||||
self.setCentralWidget(self.jsonEditor)
|
||||
|
||||
if PLATFORM == 'Darwin':
|
||||
self.toolbar = AppQToolBar(
|
||||
AppQAction(
|
||||
_('Close'),
|
||||
icon=bootstrapIcon('window-x.svg'),
|
||||
callback=lambda: self.close(),
|
||||
),
|
||||
parent=self,
|
||||
)
|
||||
|
||||
self.addToolBar(self.toolbar)
|
||||
|
||||
self.fileMenu = AppQMenu(
|
||||
AppQAction(
|
||||
_('Save'),
|
||||
|
||||
Reference in New Issue
Block a user