mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
OS X: Workaround for Qt 5 bug that causes the popup menu on the author to author sort button in the edit metadata dialog to not respond if the mouse button if not released once before clicking menu entries. See #1362338 (Copy Author Sort to Author isn't working)
https://bugreports.qt-project.org/browse/QTBUG-41017
This commit is contained in:
parent
2c4ffa1700
commit
3b2b7845de
@ -15,6 +15,7 @@ from PyQt5.Qt import (Qt, QVBoxLayout, QHBoxLayout, QWidget, QPushButton,
|
||||
QTabWidget, QIcon, QToolButton, QSplitter, QGroupBox, QSpacerItem,
|
||||
QSizePolicy, QFrame, QSize, QKeySequence, QMenu, QShortcut)
|
||||
|
||||
from calibre.constants import isosx
|
||||
from calibre.ebooks.metadata import authors_to_string, string_to_authors
|
||||
from calibre.gui2 import ResizableDialog, error_dialog, gprefs, pixmap_to_data
|
||||
from calibre.gui2.metadata.basic_widgets import (TitleEdit, AuthorsEdit,
|
||||
@ -129,6 +130,17 @@ class MetadataSingleDialogBase(ResizableDialog):
|
||||
'change author sort from red to green. There is a menu of '
|
||||
'functions available under this button. Click and hold '
|
||||
'on the button to see it.') + '</p>')
|
||||
if isosx:
|
||||
# Workaround for https://bugreports.qt-project.org/browse/QTBUG-41017
|
||||
class Menu(QMenu):
|
||||
|
||||
def mouseReleaseEvent(self, ev):
|
||||
ac = self.actionAt(ev.pos())
|
||||
if ac is not None:
|
||||
ac.trigger()
|
||||
return QMenu.mouseReleaseEvent(self, ev)
|
||||
b.m = m = Menu()
|
||||
else:
|
||||
b.m = m = QMenu()
|
||||
ac = m.addAction(QIcon(I('forward.png')), _('Set author sort from author'))
|
||||
ac2 = m.addAction(QIcon(I('back.png')), _('Set author from author sort'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user