當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。