How to implement code completion in qt

I am writing an ideal using qt (in C ++), and I need to add an automatic completion function to it

so i want to know:

how to do it (i use qtPlainTextEdit)?

What data structure should I use?

+5
source share
3 answers

I think you should take a look at this:
http://qt-project.org/doc/qt-4.8/tools-customcompleter.html

I used this example to understand CodeCompletion, and I think this is normal :)

[edit] Qt has its own class for this purpose called QCompleter: http://qt-project.org/doc/qt-4.8/qcompleter.html

+8
source

Qt, , Tobias, - , . . , .

completeter 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(), .

+3

, . , Qt Creator.

+1

All Articles