开发者

Autocomplete textbox in qt?

I am new to QT, how to implement autocomplete textbox in qt or is 开发者_高级运维there already solution for that ? I have vector of words. Can somebody give me advice how to do this ?


Take a look at QCompleter.

The QCompleter class provides completions based on an item model.

You can use QCompleter to provide auto completions in any Qt widget, such as QLineEdit and QComboBox. When the user starts typing a word, QCompleter suggests possible ways of completing the word, based on a word list. The word list is provided as a QAbstractItemModel. (For simple applications, where the word list is static, you can pass a QStringList to QCompleter's constructor.)


You can use a QComboBox with its editable attribute set to true.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜