我正在写一个ide使用qt (在c++上),我需要添加自动补全功能到它
所以我想知道:
如何做到这一点(我正在使用qtPlainTextEdit)?
我应该使用什么数据结构?
发布于 2010-03-19 16:57:46
我觉得你应该看看这个:
http://qt-project.org/doc/qt-4.8/tools-customcompleter.html
我使用这个例子来理解CodeCompletion,我认为它很好:)
edit Qt有一个自己的类,叫做QCompleter:http://qt-project.org/doc/qt-4.8/qcompleter.html
发布于 2012-10-05 20:59:13
我还需要用Qt编写一个代码完成器,而Tobias提供的第一个链接是要查看的文档。它是全面和清晰的,对我来说很有效。我肯定会为你工作的。
如果你在lineEdit中需要一个代码完成器,它非常简单(来自QCompleter文档):
QStringList wordList;
wordList << "one" << "two" << "three" << "four" << "five";
QLineEdit *lineEdit = new QLineEdit(this);
QCompleter *completer = new QCompleter(wordList, this);
lineEdit->setCompleter(completer);但是,QPlainTextEdit或QTextEdit没有内置的setCompleter()成员函数,因此您必须遵循custom code completer教程。
发布于 2010-03-19 16:54:20
这是一个巨大而复杂的特性。我会看看它是如何在the Qt Creator中实现的。
https://stackoverflow.com/questions/2475973
复制相似问题