diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py
index e76092770c..d327a56851 100644
--- a/src/calibre/gui2/tweak_book/search.py
+++ b/src/calibre/gui2/tweak_book/search.py
@@ -84,6 +84,11 @@ class WhereBox(QComboBox):
Search only within the marked text in the currently opened file. You can mark text using the Search menu.
'''))
self.emphasize = emphasize
+ self.ofont = QFont(self.font())
+ if emphasize:
+ f = self.emph_font = QFont(self.ofont)
+ f.setBold(True), f.setItalic(True)
+ self.setFont(f)
@dynamic_property
def where(self):
@@ -94,16 +99,16 @@ class WhereBox(QComboBox):
self.setCurrentIndex({v:k for k, v in wm.iteritems()}[val])
return property(fget=fget, fset=fset)
- def paintEvent(self, ev):
+ def showPopup(self):
# We do it like this so that the popup uses a normal font
if self.emphasize:
- ofont = self.font()
- f = QFont(ofont)
- f.setBold(True), f.setItalic(True)
- self.setFont(f)
- QComboBox.paintEvent(self, ev)
+ self.setFont(self.ofont)
+ QComboBox.showPopup(self)
+
+ def hidePopup(self):
if self.emphasize:
- self.setFont(ofont)
+ self.setFont(self.emph_font)
+ QComboBox.hidePopup(self)
class DirectionBox(QComboBox):