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>
|
<dd>Search only within the marked text in the currently opened file. You can mark text using the Search menu.</dd>
|
||||||
</dl>'''))
|
</dl>'''))
|
||||||
self.emphasize = emphasize
|
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
|
@dynamic_property
|
||||||
def where(self):
|
def where(self):
|
||||||
@ -94,16 +99,16 @@ class WhereBox(QComboBox):
|
|||||||
self.setCurrentIndex({v:k for k, v in wm.iteritems()}[val])
|
self.setCurrentIndex({v:k for k, v in wm.iteritems()}[val])
|
||||||
return property(fget=fget, fset=fset)
|
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
|
# We do it like this so that the popup uses a normal font
|
||||||
if self.emphasize:
|
if self.emphasize:
|
||||||
ofont = self.font()
|
self.setFont(self.ofont)
|
||||||
f = QFont(ofont)
|
QComboBox.showPopup(self)
|
||||||
f.setBold(True), f.setItalic(True)
|
|
||||||
self.setFont(f)
|
def hidePopup(self):
|
||||||
QComboBox.paintEvent(self, ev)
|
|
||||||
if self.emphasize:
|
if self.emphasize:
|
||||||
self.setFont(ofont)
|
self.setFont(self.emph_font)
|
||||||
|
QComboBox.hidePopup(self)
|
||||||
|
|
||||||
class DirectionBox(QComboBox):
|
class DirectionBox(QComboBox):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user