mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Implement underline and strikethrough
This commit is contained in:
parent
fcb72c0075
commit
5ac8d64c55
@ -283,8 +283,10 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
||||
vert = tcf.verticalAlignment()
|
||||
self.action_superscript.setChecked(vert == QTextCharFormat.AlignSuperScript)
|
||||
self.action_subscript.setChecked(vert == QTextCharFormat.AlignSubScript)
|
||||
self.action_bold.setChecked(tcf.intProperty(QTextCharFormat.FontWeight) == QFont.Bold)
|
||||
self.action_italic.setChecked(tcf.boolProperty(QTextCharFormat.FontItalic))
|
||||
self.action_bold.setChecked(tcf.fontWeight() == QFont.Bold)
|
||||
self.action_italic.setChecked(tcf.fontItalic())
|
||||
self.action_underline.setChecked(tcf.fontUnderline())
|
||||
self.action_strikethrough.setChecked(tcf.fontStrikeOut())
|
||||
|
||||
def set_readonly(self, what):
|
||||
self.readonly = what
|
||||
@ -316,10 +318,16 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
||||
c.mergeCharFormat(fmt)
|
||||
|
||||
def do_underline(self):
|
||||
raise NotImplementedError('TODO')
|
||||
with self.editing_cursor() as c:
|
||||
fmt = QTextCharFormat()
|
||||
fmt.setFontUnderline(not c.charFormat().fontUnderline())
|
||||
c.mergeCharFormat(fmt)
|
||||
|
||||
def do_strikethrough(self):
|
||||
raise NotImplementedError('TODO')
|
||||
with self.editing_cursor() as c:
|
||||
fmt = QTextCharFormat()
|
||||
fmt.setFontStrikeOut(not c.charFormat().fontStrikeOut())
|
||||
c.mergeCharFormat(fmt)
|
||||
|
||||
def do_vertical_align(self, which):
|
||||
with self.editing_cursor() as c:
|
||||
|
Loading…
x
Reference in New Issue
Block a user