本文整理汇总了Python中PyQt4.Qt.QTextCharFormat.setUnderlineStyle方法的典型用法代码示例。如果您正苦于以下问题:Python QTextCharFormat.setUnderlineStyle方法的具体用法?Python QTextCharFormat.setUnderlineStyle怎么用?Python QTextCharFormat.setUnderlineStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTextCharFormat
的用法示例。
在下文中一共展示了QTextCharFormat.setUnderlineStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: highlightBlock
# 需要导入模块: from PyQt4.Qt import QTextCharFormat [as 别名]
# 或者: from PyQt4.Qt.QTextCharFormat import setUnderlineStyle [as 别名]
def highlightBlock(self, text):
if not self.enabled:
return
fmt = QTextCharFormat()
fmt.setUnderlineColor(Qt.red)
fmt.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
for word_object in re.finditer(self.WORDS, text):
if not self.spellcheck.check(word_object.group()):
self.setFormat(word_object.start(),
word_object.end() - word_object.start(), fmt)
示例2: highlightBlock
# 需要导入模块: from PyQt4.Qt import QTextCharFormat [as 别名]
# 或者: from PyQt4.Qt.QTextCharFormat import setUnderlineStyle [as 别名]
def highlightBlock(self, text):
if not self.dict:
return
text = unicode(text)
format = QTextCharFormat()
format.setUnderlineColor(Qt.red)
format.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
for word_object in re.finditer(self.WORDS, text):
if not self.dict.check(word_object.group()):
self.setFormat(word_object.start(),
word_object.end() - word_object.start(), format)
示例3: highlight_to_char_format
# 需要导入模块: from PyQt4.Qt import QTextCharFormat [as 别名]
# 或者: from PyQt4.Qt.QTextCharFormat import setUnderlineStyle [as 别名]
def highlight_to_char_format(h):
ans = QTextCharFormat()
if h.bold:
ans.setFontWeight(QFont.Bold)
if h.italic:
ans.setFontItalic(True)
if h.fg is not None:
ans.setForeground(h.fg)
if h.bg is not None:
ans.setBackground(h.bg)
if h.underline is not None:
ans.setUnderlineStyle(underline_styles[h.underline])
if h.underline_color is not None:
ans.setUnderlineColor(h.underline_color.color())
return ans
示例4: highlightBlock
# 需要导入模块: from PyQt4.Qt import QTextCharFormat [as 别名]
# 或者: from PyQt4.Qt.QTextCharFormat import setUnderlineStyle [as 别名]
def highlightBlock(self, text):
if not self.dict:
return
if not text:
return
txt = unicode(text)
#if len(txt.split())==1:
# txt=""
#else:
# txt=txt.rsplit(' ',1)[0]
format = QTextCharFormat()
format.setUnderlineColor(Qt.red)
format.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
unicode_pattern=regex.compile(self.pattern,regex.UNICODE)
for word_object in unicode_pattern.finditer(txt):
if not self.dict.spell(word_object.group().encode('utf-8')):
self.setFormat(word_object.start(), word_object.end() - word_object.start(), format)
self.errorcount+=1
print self.errorcount