mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
aca201d3d9
@ -44,6 +44,22 @@ class DateTimeEdit(QDateTimeEdit): # {{{
|
||||
return QDateTimeEdit.keyPressEvent(self, ev)
|
||||
# }}}
|
||||
|
||||
class ClearingSpinBox(QSpinBox): # {{{
|
||||
def keyPressEvent(self, ev):
|
||||
if ev.key() == Qt.Key_Space:
|
||||
self.setValue(-1000000)
|
||||
else:
|
||||
return QSpinBox.keyPressEvent(self, ev)
|
||||
# }}}
|
||||
|
||||
class ClearingDoubleSpinBox(QDoubleSpinBox): # {{{
|
||||
def keyPressEvent(self, ev):
|
||||
if ev.key() == Qt.Key_Space:
|
||||
self.setValue(-1000000.0)
|
||||
else:
|
||||
return QDoubleSpinBox.keyPressEvent(self, ev)
|
||||
# }}}
|
||||
|
||||
class RatingDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -293,14 +309,14 @@ class CcNumberDelegate(QStyledItemDelegate): # {{{
|
||||
m = index.model()
|
||||
col = m.column_map[index.column()]
|
||||
if m.custom_columns[col]['datatype'] == 'int':
|
||||
editor = QSpinBox(parent)
|
||||
editor = ClearingSpinBox(parent)
|
||||
editor.setRange(-1000000, 100000000)
|
||||
editor.setSpecialValueText(_('Undefined'))
|
||||
editor.setSingleStep(1)
|
||||
else:
|
||||
editor = QDoubleSpinBox(parent)
|
||||
editor = ClearingDoubleSpinBox(parent)
|
||||
editor.setSpecialValueText(_('Undefined'))
|
||||
editor.setRange(-1000000., 100000000)
|
||||
editor.setRange(-1000000., 100000000.)
|
||||
editor.setDecimals(2)
|
||||
return editor
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user