Skip to content

JsonHighlighter

Qt Base Class: QSyntaxHighlighter

Signature: QSyntaxHighlighter(self, parent: PySide6.QtCore.QObject) -> None QSyntaxHighlighter(self, parent: PySide6.QtGui.QTextDocument) -> None

Base classes

Name Children Inherits
SyntaxHighlighter
prettyqt.gui.syntaxhighlighter

⋔ Inheritance diagram

graph TD
  1473296255888["syntaxhighlighters.JsonHighlighter"]
  1473245668528["gui.SyntaxHighlighter"]
  1473245664624["gui.SyntaxHighlighterMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473289231040["QtGui.QSyntaxHighlighter"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473245668528 --> 1473296255888
  1473245664624 --> 1473245668528
  1473299815024 --> 1473245664624
  140713234304496 --> 1473299815024
  1473289231040 --> 1473245668528
  1473288842240 --> 1473289231040
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: SyntaxHighlighter

Source code in prettyqt\syntaxhighlighters\jsonhighlighter.py
class JsonHighlighter(gui.SyntaxHighlighter):
    def highlightBlock(self, text: str):
        """Highlight a block of code using the rules outlined in the Constructor."""
        for m in BRACKETS.finditer(text):
            self.setFormat(m.span()[0], m.span()[1] - m.span()[0], SYMBOL_FORMAT)

        text.replace('\\"', "  ")
        for m in REGEXP1.finditer(text):
            self.setFormat(m.span()[0], m.span()[1] - m.span()[0], NAME_FORMAT)
        for m in REGEXP2.finditer(text):
            self.setFormat(m.span()[0], m.span()[1] - m.span()[0], VALUE_FORMAT)

highlightBlock(text: str)

Highlight a block of code using the rules outlined in the Constructor.

Source code in prettyqt\syntaxhighlighters\jsonhighlighter.py
def highlightBlock(self, text: str):
    """Highlight a block of code using the rules outlined in the Constructor."""
    for m in BRACKETS.finditer(text):
        self.setFormat(m.span()[0], m.span()[1] - m.span()[0], SYMBOL_FORMAT)

    text.replace('\\"', "  ")
    for m in REGEXP1.finditer(text):
        self.setFormat(m.span()[0], m.span()[1] - m.span()[0], NAME_FORMAT)
    for m in REGEXP2.finditer(text):
        self.setFormat(m.span()[0], m.span()[1] - m.span()[0], VALUE_FORMAT)

⌗ Property table

Qt Property Type Doc
objectName QString