diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index db64bce0a3..6ca08a8e64 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -17,7 +17,7 @@ from PyQt5.Qt import ( QHBoxLayout, QIcon, QKeySequence, QLabel, QLineEdit, QMenu, QPalette, QPlainTextEdit, QPushButton, QSize, QSyntaxHighlighter, Qt, QTabWidget, QTextBlockFormat, QTextCharFormat, QTextCursor, QTextEdit, QTextListFormat, - QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal, pyqtSlot, QToolButton + QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal, pyqtSlot, QToolButton, QTextFormat ) from calibre import xml_replace_entities @@ -558,11 +558,11 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ bf.setTopMargin(tmargin), bf.setBottomMargin(bmargin) bf.setHeadingLevel(lvl) if adjust: - bcf.setProperty(QTextCharFormat.FontSizeAdjustment, adjust) - cf.setProperty(QTextCharFormat.FontSizeAdjustment, adjust) + bcf.setProperty(QTextFormat.Property.FontSizeAdjustment, adjust) + cf.setProperty(QTextFormat.Property.FontSizeAdjustment, adjust) if wt: - bcf.setProperty(QTextCharFormat.FontWeight, wt) - cf.setProperty(QTextCharFormat.FontWeight, wt) + bcf.setProperty(QTextFormat.Property.FontWeight, wt) + cf.setProperty(QTextFormat.Property.FontWeight, wt) c.setBlockCharFormat(bcf) c.mergeCharFormat(cf) c.mergeBlockFormat(bf) diff --git a/src/calibre/gui2/tweak_book/editor/__init__.py b/src/calibre/gui2/tweak_book/editor/__init__.py index 0c11c32fdb..573e5be9f6 100644 --- a/src/calibre/gui2/tweak_book/editor/__init__.py +++ b/src/calibre/gui2/tweak_book/editor/__init__.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' -from PyQt5.Qt import QTextCharFormat +from PyQt5.Qt import QTextCharFormat, QTextFormat from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES from calibre.ebooks.oeb.polish.container import guess_type @@ -42,7 +42,7 @@ def editor_from_syntax(syntax, parent=None): return Editor(syntax, parent=parent) -SYNTAX_PROPERTY = QTextCharFormat.UserProperty +SYNTAX_PROPERTY = QTextFormat.Property.UserProperty SPELL_PROPERTY = SYNTAX_PROPERTY + 1 SPELL_LOCALE_PROPERTY = SPELL_PROPERTY + 1 LINK_PROPERTY = SPELL_LOCALE_PROPERTY + 1