Dynamically Syntax Highlighter
Hello :) I want to ask again for yours help :)
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?
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.
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(QTextEdit *parent); @
You should used the second one, with editor->document() as a parent.
yey, it's work's :) thanks, I'm very greatful for yours help :)