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


Python QTextCharFormat.setFontStrikeOut方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QTextCharFormat.setFontStrikeOut方法的典型用法代码示例。如果您正苦于以下问题:Python QTextCharFormat.setFontStrikeOut方法的具体用法?Python QTextCharFormat.setFontStrikeOut怎么用?Python QTextCharFormat.setFontStrikeOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui.QTextCharFormat的用法示例。


在下文中一共展示了QTextCharFormat.setFontStrikeOut方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: formatConverterFunction

# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setFontStrikeOut [as 别名]
    def formatConverterFunction(format):
        if format == qutepart.syntax.TextFormat():
            return None  # Do not apply default format. Performance optimization

        qtFormat = QTextCharFormat()

        foregroundColor = QColor(format.color)
        backgroundColor = QColor(format.background)

        if foregroundColor != Qt.black:
            qtFormat.setForeground(foregroundColor)

        if backgroundColor != Qt.white:
            qtFormat.setBackground(backgroundColor)

        qtFormat.setFontItalic(format.italic)
        qtFormat.setFontWeight(QFont.Bold if format.bold else QFont.Normal)
        qtFormat.setFontUnderline(format.underline)
        qtFormat.setFontStrikeOut(format.strikeOut)

        return qtFormat
开发者ID:MarvelHq,项目名称:qutepart,代码行数:23,代码来源:syntaxhlighter.py

示例2: makeFormat

# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setFontStrikeOut [as 别名]

#.........这里部分代码省略.........
        # size = _format.fontPointSize()
        _format = QTextCharFormat(self._defaultCharFormat)

        # Base
        if base:
            _format = base

        # Presets
        if preset in [State.CODE_AREA, State.CODE_LINE, "code"]:
            style = "bold"
            color = "black"
            fixedPitch = True
            _format.setBackground(QColor("#EEEEEE"))

        if preset in [State.COMMENT_AREA, State.COMMENT_LINE, "comment"]:
            style = "italic"
            color = "darkGreen"

        if preset in [State.SETTINGS_LINE, "setting", State.MACRO]:
            # style = "italic"
            color = "magenta"

        if preset in [State.BLOCKQUOTE_LINE]:
            color = "red"

        if preset in [State.HEADER_LINE]:
            size *= 2
            # print size

        if preset in [State.RAW_AREA, State.RAW_LINE, "raw"]:
            color = "blue"

        if preset in [State.TAGGED_AREA, State.TAGGED_LINE, "tagged"]:
            color = "purple"

        if preset in State.TITLES:
            style = "bold"
            color = "darkRed" if State.titleLevel(preset) % 2 == 1 else "blue"
            size = (self._defaultCharFormat.font().pointSize()
                    + 11 - 2 * State.titleLevel(preset))

        if preset == State.TABLE_HEADER:
            style = "bold"
            color = "darkMagenta"

        if preset == State.TABLE_LINE:
            color = "darkMagenta"

        if preset == State.LIST_BULLET:
            color = "red"
            style = "bold"
            fixedPitch = True

        if preset == State.LIST_BULLET_ENDS:
            color = "darkGray"
            fixedPitch = True

        if preset in [State.MARKUP, "markup"]:
            color = "darkGray"

        if preset in [State.HORIZONTAL_LINE]:
            color = "cyan"
            fixedPitch = True

        if preset == State.LINKS:
            color = "blue"
            # style="underline"

        if preset == "selected":
            _format.setBackground(QColor("yellow"))

        if preset == "higlighted":
            bgcolor = "yellow"

            # if preset == State.DEFAULT:
            # size = self.defaultFontPointSize
            # _format.setFontFamily(self.defaultFontFamily)

        # Manual formatting
        if color:
            _color.setNamedColor(color)
            _format.setForeground(_color)
        if bgcolor:
            _color.setNamedColor(bgcolor)
            _format.setBackground(_color)

        if 'bold' in style:
            _format.setFontWeight(QFont.Bold)
        if 'italic' in style:
            _format.setFontItalic(True)
        if 'strike' in style:
            _format.setFontStrikeOut(True)
        if 'underline' in style:
            _format.setFontUnderline(True)
        if size:
            _format.setFontPointSize(size)
        if fixedPitch:
            _format.setFontFixedPitch(True)

        return _format
开发者ID:georgehank,项目名称:manuskript,代码行数:104,代码来源:t2tHighlighterStyle.py

示例3: _strikethrough

# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setFontStrikeOut [as 别名]
 def _strikethrough(self,  value):
     charFormat = QTextCharFormat()
     charFormat.setFontStrikeOut(value)
     self.mergeCurrentCharFormat(charFormat)
开发者ID:ParaplegicRacehorse,项目名称:plume-creator,代码行数:6,代码来源:rich_text_edit.py


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