diff options
Diffstat (limited to 'doc/src/snippets/code/src_gui_util_qcompleter.cpp')
-rw-r--r-- | doc/src/snippets/code/src_gui_util_qcompleter.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_gui_util_qcompleter.cpp b/doc/src/snippets/code/src_gui_util_qcompleter.cpp new file mode 100644 index 0000000..3017d8c --- /dev/null +++ b/doc/src/snippets/code/src_gui_util_qcompleter.cpp @@ -0,0 +1,23 @@ +//! [0] +QStringList wordList; +wordList << "alpha" << "omega" << "omicron" << "zeta"; + +QLineEdit *lineEdit = new QLineEdit(this); + +QCompleter *completer = new QCompleter(wordList, this); +completer->setCaseSensitivity(Qt::CaseInsensitive); +lineEdit->setCompleter(completer); +//! [0] + + +//! [1] +QCompleter *completer = new QCompleter(this); +completer->setModel(new QDirModel(completer)); +lineEdit->setCompleter(completer); +//! [1] + + +//! [2] +for (int i = 0; completer->setCurrentRow(i); i++) + qDebug() << completer->currentCompletion() << " is match number " << i; +//! [2] |