refactor
This commit is contained in:
13
mdi.py
13
mdi.py
@ -23,15 +23,16 @@ class MDIArea(QMdiArea):
|
||||
menu.addAction("Close All")
|
||||
menu.triggered[QAction].connect(self.on_menu_select)
|
||||
|
||||
self.actions = {
|
||||
"Cascade": self.cascadeSubWindows,
|
||||
"Tile": self.tileSubWindows,
|
||||
"Close All": self.closeAllSubWindows
|
||||
}
|
||||
|
||||
|
||||
def on_menu_select(self, p):
|
||||
txt = p.text()
|
||||
if txt == "Cascade":
|
||||
self.cascadeSubWindows()
|
||||
elif txt == "Tile":
|
||||
self.tileSubWindows()
|
||||
elif txt == "Close All":
|
||||
self.closeAllSubWindows()
|
||||
self.actions[txt]()
|
||||
|
||||
|
||||
def paintEvent(self, _event):
|
||||
|
Reference in New Issue
Block a user