当前位置: 首页>>代码示例>>Python>>正文


Python QTextCharFormat.setUnderlineStyle方法代码示例

本文整理汇总了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)
开发者ID:runt18,项目名称:git-cola,代码行数:13,代码来源:spellcheck.py

示例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)
开发者ID:RaminNietzsche,项目名称:GuiNegar,代码行数:16,代码来源:GNegar.py

示例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
开发者ID:randy1,项目名称:calibre,代码行数:17,代码来源:themes.py

示例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
开发者ID:akshaylb,项目名称:spellchecker-np,代码行数:21,代码来源:main.py


注:本文中的PyQt4.Qt.QTextCharFormat.setUnderlineStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。