mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix saved search dialog causing high CPU usage
This commit is contained in:
parent
47b6df13d0
commit
77a58c8511
@ -84,6 +84,11 @@ class WhereBox(QComboBox):
|
||||
<dd>Search only within the marked text in the currently opened file. You can mark text using the Search menu.</dd>
|
||||
</dl>'''))
|
||||
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):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user