[Qt-interest] Syntex highlighting in QTextEdit (for LaTeX Syntax)
Lorenzo Bettini
bettini at dsi.unifi.it
Sun Nov 15 11:28:48 CET 2009
Matthias Pospiech wrote:
> I want to display and let the user edit LaTeX Source Code.
> The QTextEdit Class is what I found that Qt provides.
> However it is unclear to me which solutions exist to integrate syntax
> highlighting.
>
> I know that many Qt derived programms use a syntax highlighting.
> I have not the time to reinvent the wheel, especially since I am not
> writing a
> LaTeX Editor. Therefore I am especially interested in solutions which
> are ready to use.
>
> Matthias
Hi
I recently released this library http://srchiliteqt.sourceforge.net/
Source-highlight-qt is a library for performing syntax highlighting in
Qt documents by relying on GNU Source-Highlight library,
http://www.gnu.org/software/src-highlite/. and Source-highlight already
has syntax highlighting for Latex code.
for standard usage, it's just a matter of executing this code (you can
pass the language syntax, i.e., the source-highlight language definition
file, to the init method):
QTextEdit *editor = new QTextEdit;
srchiliteqt::Qt4SyntaxHighlighter *highlighter =
new srchiliteqt::Qt4SyntaxHighlighter(editor->document());
highlighter->init("latex.lang");
please let me know whether you need further help
cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
More information about the Qt-interest-old
mailing list