Where can I find Qt4 source code editor widget? [closed]

拈花ヽ惹草 提交于 2019-12-20 19:42:03

问题


I want to provide a QtScript source code editor in my application. It would be great if this would have source code highlighting and auto completion.

So I don't want to reinvent the wheel: Is there already a quite good widget for that? I could not find anything on Google...


回答1:


See QScintilla. It has Javascript highlighting and (auto-)completion support built-in.




回答2:


You can use QTextEdit and QSyntaxHighlighter together to get text editing features with syntax highlighting. See Qt's richtext\syntaxhighlighter example.

QtScript is based on the ECMAScript scripting language as is JavaScript, so I guess you could use JavaScript syntax highlighting without any big problems. So if you don't want to code the new QSyntaxHighlighter from scratch, maybe you could use this JavaScript editing widget.




回答3:


Try stealing the official one, you want src/editor/scripthighlighter.h and src/editor/scripthighlighter.cpp




回答4:


Try KatePart of KDE:

http://kate-editor.org/about-katepart/

To quote:

KatePart is a fast and feature-rich text editor component with many advanced features. It implements the KTextEditor interfaces, a common interface collection for text editor components in KDE, allowing it to be selected as the editor in applications that lets the user chose from different implementations, and it can use KTextEditor plug-ins.

KatePart is originally based on code from the KDE 1 richtext editor widget, but has been almost completely rewritten over the years. It is the default text editor widget in Kate and KWrite and also the default to display text in Konqueror. A lot of other applications use it as text editing component, too, like KDevelop.




回答5:


  • Full-fledged code editor widget: QCodeEdit
  • Very simple solution: QtScript highlighter (MultiLineCommentHighlighter class is defined here)


来源:https://stackoverflow.com/questions/3734085/where-can-i-find-qt4-source-code-editor-widget

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!