mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
...
This commit is contained in:
parent
8e74361336
commit
4b88420482
1 changed files with 5 additions and 5 deletions
|
|
@ -6,7 +6,7 @@
|
|||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import re, time
|
||||
from functools import partial
|
||||
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
class SearchLineEdit(QLineEdit): # {{{
|
||||
key_pressed = pyqtSignal(object)
|
||||
select_on_mouse_press = False
|
||||
select_on_mouse_press = None
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
self.key_pressed.emit(event)
|
||||
|
|
@ -41,14 +41,14 @@ def paste(self, *args):
|
|||
return QLineEdit.paste(self)
|
||||
|
||||
def focusInEvent(self, ev):
|
||||
self.select_on_mouse_press = True
|
||||
self.select_on_mouse_press = time.time()
|
||||
return QLineEdit.focusInEvent(self, ev)
|
||||
|
||||
def mousePressEvent(self, ev):
|
||||
QLineEdit.mousePressEvent(self, ev)
|
||||
if self.select_on_mouse_press:
|
||||
self.select_on_mouse_press = False
|
||||
if self.select_on_mouse_press is not None and abs(time.time() - self.select_on_mouse_press) < 0.2:
|
||||
self.selectAll()
|
||||
self.select_on_mouse_press = None
|
||||
# }}}
|
||||
|
||||
class SearchBox2(QComboBox): # {{{
|
||||
|
|
|
|||
Loading…
Reference in a new issue