本文整理匯總了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