mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for impossible error
This commit is contained in:
parent
6e02b9f8c1
commit
4cee8bb4fa
@ -373,6 +373,9 @@ class Editor(QMainWindow):
|
|||||||
bar.addAction(ac)
|
bar.addAction(ac)
|
||||||
if name == 'insert-tag':
|
if name == 'insert-tag':
|
||||||
w = bar.widgetForAction(ac)
|
w = bar.widgetForAction(ac)
|
||||||
|
if hasattr(w, 'setPopupMode'):
|
||||||
|
# For some unknown reason this button is occassionally a
|
||||||
|
# QPushButton instead of a QToolButton
|
||||||
w.setPopupMode(QToolButton.MenuButtonPopup)
|
w.setPopupMode(QToolButton.MenuButtonPopup)
|
||||||
w.setMenu(self.insert_tag_menu)
|
w.setMenu(self.insert_tag_menu)
|
||||||
w.setContextMenuPolicy(Qt.CustomContextMenu)
|
w.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||||
@ -382,6 +385,9 @@ class Editor(QMainWindow):
|
|||||||
m = ac.m = QMenu()
|
m = ac.m = QMenu()
|
||||||
ac.setMenu(m)
|
ac.setMenu(m)
|
||||||
ch = bar.widgetForAction(ac)
|
ch = bar.widgetForAction(ac)
|
||||||
|
if hasattr(ch, 'setPopupMode'):
|
||||||
|
# For some unknown reason this button is occassionally a
|
||||||
|
# QPushButton instead of a QToolButton
|
||||||
ch.setPopupMode(QToolButton.InstantPopup)
|
ch.setPopupMode(QToolButton.InstantPopup)
|
||||||
for name in tuple('h%d' % d for d in range(1, 7)) + ('p',):
|
for name in tuple('h%d' % d for d in range(1, 7)) + ('p',):
|
||||||
m.addAction(actions['rename-block-tag-%s' % name])
|
m.addAction(actions['rename-block-tag-%s' % name])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user