forked from openlp/openlp
Fix bug 1247661 by restoring to main window when the dock icon is clicked
This commit is contained in:
parent
41c695bbec
commit
16425b05a0
@ -250,7 +250,7 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
|
||||
|
||||
def event(self, event):
|
||||
"""
|
||||
Enables direct file opening on OS X
|
||||
Enables platform specific event handling i.e. direct file opening on OS X
|
||||
|
||||
:param event: The event
|
||||
"""
|
||||
@ -259,8 +259,19 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
|
||||
log.debug('Got open file event for %s!', file_name)
|
||||
self.args.insert(0, file_name)
|
||||
return True
|
||||
else:
|
||||
return QtGui.QApplication.event(self, event)
|
||||
# Mac OS X should restore app window when user clicked on the OpenLP icon
|
||||
# in the Dock bar. However, OpenLP consists of multiple windows and this
|
||||
# does not work. This workaround fixes that.
|
||||
# The main OpenLP window is restored when it was previously minimized.
|
||||
elif event.type() == QtCore.QEvent.ApplicationActivate:
|
||||
if is_macosx() and hasattr(self, 'main_window'):
|
||||
if self.main_window.isMinimized():
|
||||
# Copied from QWidget.setWindowState() docs on how to restore and activate a minimized window
|
||||
# while preserving its maximized and/or full-screen state.
|
||||
self.main_window.setWindowState(self.main_window.windowState() & ~QtCore.Qt.WindowMinimized |
|
||||
QtCore.Qt.WindowActive)
|
||||
return True
|
||||
return QtGui.QApplication.event(self, event)
|
||||
|
||||
|
||||
def parse_options(args):
|
||||
|
Loading…
Reference in New Issue
Block a user