mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-22 15:56:21 +01:00
Implement super/sub-script
This commit is contained in:
parent
ed843864a0
commit
badb775611
1 changed files with 13 additions and 2 deletions
|
|
@ -148,6 +148,10 @@ def update_cursor_position_actions(self):
|
|||
ls = c.currentList()
|
||||
self.action_ordered_list.setChecked(ls is not None and ls.format().style() == QTextListFormat.ListDecimal)
|
||||
self.action_unordered_list.setChecked(ls is not None and ls.format().style() == QTextListFormat.ListDisc)
|
||||
tcf = c.charFormat()
|
||||
vert = tcf.verticalAlignment()
|
||||
self.action_superscript.setChecked(vert == QTextCharFormat.AlignSuperScript)
|
||||
self.action_subscript.setChecked(vert == QTextCharFormat.AlignSubScript)
|
||||
|
||||
def set_readonly(self, what):
|
||||
self.readonly = what
|
||||
|
|
@ -177,11 +181,18 @@ def do_underline(self):
|
|||
def do_strikethrough(self):
|
||||
raise NotImplementedError('TODO')
|
||||
|
||||
def do_vertical_align(self, which):
|
||||
c = self.textCursor()
|
||||
fmt = QTextCharFormat()
|
||||
fmt.setVerticalAlignment(which)
|
||||
c.mergeCharFormat(fmt)
|
||||
self.setTextCursor(c)
|
||||
|
||||
def do_superscript(self):
|
||||
raise NotImplementedError('TODO')
|
||||
self.do_vertical_align(QTextCharFormat.AlignSuperScript)
|
||||
|
||||
def do_subscript(self):
|
||||
raise NotImplementedError('TODO')
|
||||
self.do_vertical_align(QTextCharFormat.AlignSubScript)
|
||||
|
||||
def do_list(self, fmt):
|
||||
c = self.textCursor()
|
||||
|
|
|
|||
Loading…
Reference in a new issue