Remove workaround for QTBUG-42281

This commit is contained in:
Kovid Goyal 2017-05-09 10:52:23 +05:30
parent dea21e5f97
commit fbefbc57cc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 3 additions and 28 deletions

View File

@ -1,3 +0,0 @@
Undo the workaround for WindowBlocked/Unblocked in Qt >= 5.6
https://bugreports.qt-project.org/browse/QTBUG-42281

View File

@ -31,6 +31,7 @@ class MenuBarAction(QAction):
def menu(self):
return self.parent()
menu_counter = 0
@ -58,10 +59,6 @@ class ExportedMenuBar(QMenuBar): # {{{
self.dbus_menu.publish_new_menu(self)
self.register()
parent.installEventFilter(self)
# See https://bugreports.qt-project.org/browse/QTBUG-42281
if hasattr(parent, 'window_blocked'):
parent.window_blocked.connect(self._block)
parent.window_unblocked.connect(self._unblock)
def register(self, menu_registrar=None):
self.menu_registrar = menu_registrar or self.menu_registrar
@ -103,13 +100,6 @@ class ExportedMenuBar(QMenuBar): # {{{
def eventFilter(self, obj, ev):
etype = ev.type()
# WindowBlocked and WindowUnblocked aren't delivered to event filters,
# so we have to rely on co-operation from the mainwindow class
# See https://bugreports.qt-project.org/browse/QTBUG-42281
# if etype == QEvent.WindowBlocked:
# self._block()
# elif etype == QEvent.WindowUnblocked:
# self._unblock()
if etype == QEvent.Show:
# Hiding a window causes the registrar to auto-unregister it, so we
# have to re-register it on show events.
@ -254,6 +244,7 @@ class Factory(QObject):
self.bus
# TODO: have the created widgets also handle bus disconnection
_factory = None

View File

@ -8,7 +8,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import StringIO, traceback, sys, gc, weakref
from PyQt5.Qt import (QMainWindow, QTimer, QAction, QMenu, QMenuBar, QIcon,
pyqtSignal, QObject)
QObject)
from calibre.utils.config import OptionParser
from calibre.gui2 import error_dialog
from calibre import prints
@ -90,10 +90,6 @@ class MainWindow(QMainWindow):
___menu = None
__actions = []
# See https://bugreports.qt-project.org/browse/QTBUG-42281
window_blocked = pyqtSignal()
window_unblocked = pyqtSignal()
@classmethod
def create_application_menubar(cls):
if not cls.__actions:
@ -156,15 +152,6 @@ class MainWindow(QMainWindow):
except:
pass
def event(self, ev):
# See https://bugreports.qt-project.org/browse/QTBUG-42281
etype = ev.type()
if etype == ev.WindowBlocked:
self.window_blocked.emit()
elif etype == ev.WindowUnblocked:
self.window_unblocked.emit()
return QMainWindow.event(self, ev)
def clone_menu(menu):
# This is needed to workaround a bug in Qt 5.5+ and Unity. When the same