Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Dynamically Syntax Highlighter
Qt 6.11 is out! See what's new in the release blog

Dynamically Syntax Highlighter

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BlackDante
    wrote on last edited by
    #1

    Hello :) I want to ask again for yours help :)
    In my project to university, I'm creating somthink like editor to webmasters who will support few language like php or javascript, and I have little question about QSytnaxHighlighter :)
    In example of this beautiful is use only static highlight, so if user will enter some data from keyboard, this data will be don't higlight. So I think that somethink like that will be good solution

    @connect(editor,SIGNAL(textChanged ()),this,SLOT(rehighlight ()));@

    but this will take much more memory than I except... so i wanna know, is a another way to do that?

    sorry for my broken english :)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      The highlighting as in the example (Qt Sources/examples/richtext/syntaxhighlighter) is dynamic. As soon as the user enters text, the highlighting is adapted. Also, there is no connect() necessary if you set up the highlighter with the text document.

      The "Syntax Highlighter Example"http://doc.qt.nokia.com/stable/richtext-syntaxhighlighter.html has some more explanations.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BlackDante
        wrote on last edited by
        #3

        Oh, I'm sorry, I must miss that in this Example, but I have another question. Can be QSyntaxHighlighter used with QPlainTextEdit ? If anwser is yes, How can to do this? Because QPlainTextEdit is a Widget and only constructors are:
        @QSyntaxHighlighter(QObject *parent);
        QSyntaxHighlighter(QTextDocument *parent);
        QSyntaxHighlighter(QTextEdit *parent); @

        sorry for my broken english :)

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vcsala
          wrote on last edited by
          #4

          You should used the second one, with editor->document() as a parent.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            BlackDante
            wrote on last edited by
            #5

            yey, it's work's :) thanks, I'm very greatful for yours help :)

            sorry for my broken english :)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved