summaryrefslogtreecommitdiffstats
path: root/examples/tools/completer
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /examples/tools/completer
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'examples/tools/completer')
-rw-r--r--examples/tools/completer/completer.pro12
-rw-r--r--examples/tools/completer/completer.qrc6
-rw-r--r--examples/tools/completer/dirmodel.cpp63
-rw-r--r--examples/tools/completer/dirmodel.h61
-rw-r--r--examples/tools/completer/main.cpp55
-rw-r--r--examples/tools/completer/mainwindow.cpp264
-rw-r--r--examples/tools/completer/mainwindow.h87
-rw-r--r--examples/tools/completer/resources/countries.txt241
-rw-r--r--examples/tools/completer/resources/wordlist.txt1486
9 files changed, 2275 insertions, 0 deletions
diff --git a/examples/tools/completer/completer.pro b/examples/tools/completer/completer.pro
new file mode 100644
index 0000000..4ac5084
--- /dev/null
+++ b/examples/tools/completer/completer.pro
@@ -0,0 +1,12 @@
+HEADERS = dirmodel.h \
+ mainwindow.h
+SOURCES = dirmodel.cpp \
+ main.cpp \
+ mainwindow.cpp
+RESOURCES = completer.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/tools/completer
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS completer.pro resources
+sources.path = $$[QT_INSTALL_EXAMPLES]/tools/completer
+INSTALLS += target sources
diff --git a/examples/tools/completer/completer.qrc b/examples/tools/completer/completer.qrc
new file mode 100644
index 0000000..4f57e1a8
--- /dev/null
+++ b/examples/tools/completer/completer.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>resources/countries.txt</file>
+ <file>resources/wordlist.txt</file>
+</qresource>
+</RCC>
diff --git a/examples/tools/completer/dirmodel.cpp b/examples/tools/completer/dirmodel.cpp
new file mode 100644
index 0000000..1daf03c
--- /dev/null
+++ b/examples/tools/completer/dirmodel.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "dirmodel.h"
+
+//! [0]
+DirModel::DirModel(QObject *parent)
+ : QDirModel(parent)
+{
+}
+//! [0]
+
+//! [1]
+QVariant DirModel::data(const QModelIndex &index, int role) const
+{
+ if (role == Qt::DisplayRole && index.column() == 0) {
+ QString path = QDir::toNativeSeparators(filePath(index));
+ if (path.endsWith(QDir::separator()))
+ path.chop(1);
+ return path;
+ }
+
+ return QDirModel::data(index, role);
+}
+//! [1]
diff --git a/examples/tools/completer/dirmodel.h b/examples/tools/completer/dirmodel.h
new file mode 100644
index 0000000..bd49ca9
--- /dev/null
+++ b/examples/tools/completer/dirmodel.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DIRMODEL_H
+#define DIRMODEL_H
+
+#include <QDirModel>
+
+// With a QDirModel, set on a view, you will see "Program Files" in the view
+// But with this model, you will see "C:\Program Files" in the view.
+// We acheive this, by having the data() return the entire file path for
+// the display role. Note that the Qt::EditRole over which the QCompleter
+// looks for matches is left unchanged
+//! [0]
+class DirModel : public QDirModel
+{
+public:
+ DirModel(QObject *parent = 0);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+};
+//! [0]
+
+#endif
diff --git a/examples/tools/completer/main.cpp b/examples/tools/completer/main.cpp
new file mode 100644
index 0000000..a414cd5
--- /dev/null
+++ b/examples/tools/completer/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "mainwindow.h"
+
+//! [0]
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(completer);
+
+ QApplication app(argc, argv);
+ MainWindow window;
+ window.show();
+ return app.exec();
+}
+//! [0]
diff --git a/examples/tools/completer/mainwindow.cpp b/examples/tools/completer/mainwindow.cpp
new file mode 100644
index 0000000..862967a
--- /dev/null
+++ b/examples/tools/completer/mainwindow.cpp
@@ -0,0 +1,264 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "dirmodel.h"
+#include "mainwindow.h"
+
+//! [0]
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent), completer(0), lineEdit(0)
+{
+ createMenu();
+
+ QWidget *centralWidget = new QWidget;
+
+ QLabel *modelLabel = new QLabel;
+ modelLabel->setText(tr("Model"));
+
+ modelCombo = new QComboBox;
+ modelCombo->addItem(tr("QDirModel"));
+ modelCombo->addItem(tr("QDirModel that shows full path"));
+ modelCombo->addItem(tr("Country list"));
+ modelCombo->addItem(tr("Word list"));
+ modelCombo->setCurrentIndex(0);
+
+ QLabel *modeLabel = new QLabel;
+ modeLabel->setText(tr("Completion Mode"));
+ modeCombo = new QComboBox;
+ modeCombo->addItem(tr("Inline"));
+ modeCombo->addItem(tr("Filtered Popup"));
+ modeCombo->addItem(tr("Unfiltered Popup"));
+ modeCombo->setCurrentIndex(1);
+
+ QLabel *caseLabel = new QLabel;
+ caseLabel->setText(tr("Case Sensitivity"));
+ caseCombo = new QComboBox;
+ caseCombo->addItem(tr("Case Insensitive"));
+ caseCombo->addItem(tr("Case Sensitive"));
+ caseCombo->setCurrentIndex(0);
+//! [0]
+
+//! [1]
+ wrapCheckBox = new QCheckBox;
+ wrapCheckBox->setText(tr("Wrap around completions"));
+ wrapCheckBox->setChecked(true);
+//! [1]
+
+//! [2]
+ contentsLabel = new QLabel;
+ contentsLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+ connect(modelCombo, SIGNAL(activated(int)), this, SLOT(changeModel()));
+ connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int)));
+ connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int)));
+//! [2]
+
+//! [3]
+ lineEdit = new QLineEdit;
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(modelLabel, 0, 0); layout->addWidget(modelCombo, 0, 1);
+ layout->addWidget(modeLabel, 1, 0); layout->addWidget(modeCombo, 1, 1);
+ layout->addWidget(caseLabel, 2, 0); layout->addWidget(caseCombo, 2, 1);
+ layout->addWidget(wrapCheckBox, 3, 0);
+ layout->addWidget(contentsLabel, 4, 0, 1, 2);
+ layout->addWidget(lineEdit, 5, 0, 1, 2);
+ centralWidget->setLayout(layout);
+ setCentralWidget(centralWidget);
+
+ changeModel();
+
+ setWindowTitle(tr("Completer"));
+ lineEdit->setFocus();
+}
+//! [3]
+
+//! [4]
+void MainWindow::createMenu()
+{
+ QAction *exitAction = new QAction(tr("Exit"), this);
+ QAction *aboutAct = new QAction(tr("About"), this);
+ QAction *aboutQtAct = new QAction(tr("About Qt"), this);
+
+ connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+ connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
+ connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+
+ QMenu* fileMenu = menuBar()->addMenu(tr("File"));
+ fileMenu->addAction(exitAction);
+
+ QMenu* helpMenu = menuBar()->addMenu(tr("About"));
+ helpMenu->addAction(aboutAct);
+ helpMenu->addAction(aboutQtAct);
+}
+//! [4]
+
+//! [5]
+QAbstractItemModel *MainWindow::modelFromFile(const QString& fileName)
+{
+ QFile file(fileName);
+ if (!file.open(QFile::ReadOnly))
+ return new QStringListModel(completer);
+//! [5]
+
+//! [6]
+#ifndef QT_NO_CURSOR
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+#endif
+ QStringList words;
+
+ while (!file.atEnd()) {
+ QByteArray line = file.readLine();
+ if (!line.isEmpty())
+ words << line.trimmed();
+ }
+
+#ifndef QT_NO_CURSOR
+ QApplication::restoreOverrideCursor();
+#endif
+//! [6]
+
+//! [7]
+ if (!fileName.contains(QLatin1String("countries.txt")))
+ return new QStringListModel(words, completer);
+//! [7]
+
+ // The last two chars of the countries.txt file indicate the country
+ // symbol. We put that in column 2 of a standard item model
+//! [8]
+ QStandardItemModel *m = new QStandardItemModel(words.count(), 2, completer);
+//! [8] //! [9]
+ for (int i = 0; i < words.count(); ++i) {
+ QModelIndex countryIdx = m->index(i, 0);
+ QModelIndex symbolIdx = m->index(i, 1);
+ QString country = words[i].mid(0, words[i].length() - 2).trimmed();
+ QString symbol = words[i].right(2);
+ m->setData(countryIdx, country);
+ m->setData(symbolIdx, symbol);
+ }
+
+ return m;
+}
+//! [9]
+
+//! [10]
+void MainWindow::changeMode(int index)
+{
+ QCompleter::CompletionMode mode;
+ if (index == 0)
+ mode = QCompleter::InlineCompletion;
+ else if (index == 1)
+ mode = QCompleter::PopupCompletion;
+ else
+ mode = QCompleter::UnfilteredPopupCompletion;
+
+ completer->setCompletionMode(mode);
+}
+//! [10]
+
+void MainWindow::changeCase(int cs)
+{
+ completer->setCaseSensitivity(cs ? Qt::CaseSensitive : Qt::CaseInsensitive);
+}
+
+//! [11]
+void MainWindow::changeModel()
+{
+ delete completer;
+ completer = new QCompleter(this);
+
+ switch (modelCombo->currentIndex()) {
+ default:
+ case 0:
+ { // Unsorted QDirModel
+ QDirModel *dirModel = new QDirModel(completer);
+ completer->setModel(dirModel);
+ contentsLabel->setText(tr("Enter file path"));
+ }
+ break;
+//! [11] //! [12]
+ case 1:
+ { // DirModel that shows full paths
+ DirModel *dirModel = new DirModel(completer);
+ completer->setModel(dirModel);
+ contentsLabel->setText(tr("Enter file path"));
+ }
+ break;
+//! [12] //! [13]
+ case 2:
+ { // Country List
+ completer->setModel(modelFromFile(":/resources/countries.txt"));
+ QTreeView *treeView = new QTreeView;
+ completer->setPopup(treeView);
+ treeView->setRootIsDecorated(false);
+ treeView->header()->hide();
+ treeView->header()->setStretchLastSection(false);
+ treeView->header()->setResizeMode(0, QHeaderView::Stretch);
+ treeView->header()->setResizeMode(1, QHeaderView::ResizeToContents);
+ contentsLabel->setText(tr("Enter name of your country"));
+ }
+ break;
+//! [13] //! [14]
+ case 3:
+ { // Word list
+ completer->setModel(modelFromFile(":/resources/wordlist.txt"));
+ completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
+ contentsLabel->setText(tr("Enter a word"));
+ }
+ break;
+ }
+
+ changeMode(modeCombo->currentIndex());
+ changeCase(caseCombo->currentIndex());
+ completer->setWrapAround(wrapCheckBox->isChecked());
+ lineEdit->setCompleter(completer);
+ connect(wrapCheckBox, SIGNAL(clicked(bool)), completer, SLOT(setWrapAround(bool)));
+}
+//! [14]
+
+//! [15]
+void MainWindow::about()
+{
+ QMessageBox::about(this, tr("About"), tr("This example demonstrates the "
+ "different features of the QCompleter class."));
+}
+//! [15]
diff --git a/examples/tools/completer/mainwindow.h b/examples/tools/completer/mainwindow.h
new file mode 100644
index 0000000..f6fba9c
--- /dev/null
+++ b/examples/tools/completer/mainwindow.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+QT_BEGIN_NAMESPACE
+class QAbstractItemModel;
+class QComboBox;
+class QCompleter;
+class QLabel;
+class QLineEdit;
+class QProgressBar;
+class QCheckBox;
+QT_END_NAMESPACE
+
+//! [0]
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+
+private slots:
+ void about();
+ void changeCase(int);
+ void changeMode(int);
+ void changeModel();
+//! [0]
+
+//! [1]
+private:
+ void createMenu();
+ QAbstractItemModel *modelFromFile(const QString& fileName);
+
+ QComboBox *caseCombo;
+ QComboBox *modeCombo;
+ QComboBox *modelCombo;
+ QCheckBox *wrapCheckBox;
+ QCompleter *completer;
+ QLabel *contentsLabel;
+ QLineEdit *lineEdit;
+};
+//! [1]
+
+#endif // MAINWINDOW_H
diff --git a/examples/tools/completer/resources/countries.txt b/examples/tools/completer/resources/countries.txt
new file mode 100644
index 0000000..5854fbc
--- /dev/null
+++ b/examples/tools/completer/resources/countries.txt
@@ -0,0 +1,241 @@
+Afghanistan AF
+Albania AL
+Algeria DZ
+American Samoa AS
+Andorra AD
+Angola AO
+Anguilla AI
+Antarctica AQ
+Antigua And Barbuda AG
+Argentina AR
+Armenia AM
+Aruba AW
+Australia AU
+Austria AT
+Azerbaijan AZ
+Bahamas BS
+Bahrain BH
+Bangladesh BD
+Barbados BB
+Belarus BY
+Belgium BE
+Belize BZ
+Benin BJ
+Bermuda BM
+Bhutan BT
+Bolivia BO
+Bosnia And Herzegowina BA
+Botswana BW
+Bouvet Island BV
+Brazil BR
+British Indian Ocean Territory IO
+British Virgin Islands VG
+Brunei Darussalam BN
+Bulgaria BG
+Burkina Faso BF
+Burundi BI
+Cambodia KH
+Cameroon CM
+Canada CA
+Cape Verde CV
+Cayman Islands KY
+Central African Republic CF
+Chad TD
+Chile CL
+China CN
+Christmas Island CX
+Cocos Islands CC
+Colombia CO
+Comoros KM
+Cook Islands CK
+Costa Rica CR
+Croatia HR
+Cuba CU
+Cyprus CY
+Czech Republic CZ
+Democratic Republic Of Congo CD
+Democratic Republic Of Korea KP
+Denmark DK
+Djibouti DJ
+Dominica DM
+Dominican Republic DO
+EastTimor TL
+Ecuador EC
+Egypt EG
+El Salvador SV
+Equatorial Guinea GQ
+Eritrea ER
+Estonia EE
+Ethiopia ET
+Falkland Islands FK
+Faroe Islands FO
+Fiji FJ
+Finland FI
+France FR
+French Guiana GF
+French Polynesia PF
+French Southern Territories TF
+Gabon GA
+Gambia GM
+Georgia GE
+Germany DE
+Ghana GH
+Gibraltar GI
+Greece GR
+Greenland GL
+Grenada GD
+Guadeloupe GP
+Guam GU
+Guatemala GT
+Guinea GN
+Guinea Bissau GW
+Guyana GY
+Haiti HT
+Heard And McDonald Islands HM
+Honduras HN
+Hong Kong HK
+Hungary HU
+Iceland IS
+India IN
+Indonesia ID
+Iran IR
+Iraq IQ
+Ireland IE
+Israel IL
+Italy IT
+Ivory Coast CI
+Jamaica JM
+Japan JP
+Jordan JO
+Kazakhstan KZ
+Kenya KE
+Kiribati KI
+Kuwait KW
+Kyrgyzstan KG
+Lao LA
+Latvia LV
+Lebanon LB
+Lesotho LS
+Liberia LR
+Libyan Arab Jamahiriya LY
+Liechtenstein LI
+Lithuania LT
+Luxembourg LU
+Macau MO
+Macedonia MK
+Madagascar MG
+Malawi MW
+Malaysia MY
+Maldives MV
+Mali ML
+Malta MT
+Marshall Islands MH
+Martinique MQ
+Mauritania MR
+Mauritius MU
+Mayotte YT
+Metropolitan France FX
+Mexico MX
+Micronesia FM
+Moldova MD
+Monaco MC
+Mongolia MN
+Montserrat MS
+Morocco MA
+Mozambique MZ
+Myanmar MM
+Namibia NA
+Nauru NR
+Nepal NP
+Netherlands NL
+Netherlands Antilles AN
+New Caledonia NC
+New Zealand NZ
+Nicaragua NI
+Niger NE
+Nigeria NG
+Niue NU
+Norfolk Island NF
+Northern Mariana Islands MP
+Norway NO
+Oman OM
+Pakistan PK
+Palau PW
+Palestinian Territory PS
+Panama PA
+Papua New Guinea PG
+Paraguay PY
+Peoples Republic Of Congo CG
+Peru PE
+Philippines PH
+Pitcairn PN
+Poland PL
+Portugal PT
+Puerto Rico PR
+Qatar QA
+Republic Of Korea KR
+Reunion RE
+Romania RO
+Russian Federation RU
+Rwanda RW
+Saint Kitts And Nevis KN
+Samoa WS
+San Marino SM
+Sao Tome And Principe ST
+Saudi Arabia SA
+Senegal SN
+Serbia And Montenegro CS
+Seychelles SC
+Sierra Leone SL
+Singapore SG
+Slovakia SK
+Slovenia SI
+Solomon Islands SB
+Somalia SO
+South Africa ZA
+South Georgia And The South Sandwich Islands GS
+Spain ES
+Sri Lanka LK
+St Helena SH
+St Lucia LC
+St Pierre And Miquelon PM
+St Vincent And The Grenadines VC
+Sudan SD
+Suriname SR
+Svalbard And Jan Mayen Islands SJ
+Swaziland SZ
+Sweden SE
+Switzerland CH
+Syrian Arab Republic SY
+Taiwan TW
+Tajikistan TJ
+Tanzania TZ
+Thailand TH
+Togo TG
+Tokelau TK
+Tonga TO
+Trinidad And Tobago TT
+Tunisia TN
+Turkey TR
+Turkmenistan TM
+Turks And Caicos Islands TC
+Tuvalu TV
+US Virgin Islands VI
+Uganda UG
+Ukraine UA
+United Arab Emirates AE
+United Kingdom GB
+United States US
+United States Minor Outlying Islands UM
+Uruguay UY
+Uzbekistan UZ
+Vanuatu VU
+Vatican City State VA
+Venezuela VE
+Viet Nam VN
+Wallis And Futuna Islands WF
+Western Sahara EH
+Yemen YE
+Yugoslavia YU
+Zambia ZM
+Zimbabwe ZW
diff --git a/examples/tools/completer/resources/wordlist.txt b/examples/tools/completer/resources/wordlist.txt
new file mode 100644
index 0000000..e598a19
--- /dev/null
+++ b/examples/tools/completer/resources/wordlist.txt
@@ -0,0 +1,1486 @@
+A4
+able
+about
+above
+absence
+absolutely
+abstract
+access
+according
+accumulated
+achieve
+achieving
+activity
+acts
+actual
+actually
+add
+added
+adding
+addition
+additionally
+additions
+addresses
+adjust
+adjustments
+advanced
+advice
+after
+afterwards
+again
+agenda
+aim
+algorithm
+all
+allocated
+allow
+allowed
+allowing
+allows
+along
+alpha
+already
+also
+alternative
+alternatively
+although
+American
+an
+and
+announced
+annoy
+another
+answer
+answers
+any
+anything
+anyway
+apart
+API
+appear
+appears
+appendices
+appendix
+appends
+application
+applications
+apply
+approach
+approaches
+appropriate
+Arabic
+arbitrary
+are
+areas
+ARGB
+argument
+arguments
+around
+arrangements
+arrive
+arrived
+Arthur
+article
+articles
+as
+asked
+aspects
+assume
+at
+attachment
+attempt
+attempting
+attend
+attendees
+attributes
+authors
+auto-detect
+auto-detecting
+availability
+available
+avoid
+away
+back
+background
+backgrounds
+bandwidth
+bandwidths
+Barcelona
+base
+based
+basic
+basically
+basics
+be
+because
+been
+before
+behave
+behavior
+behind
+being
+below
+benefits
+Berkeley
+between
+bit
+bits
+bitwise
+black
+blended
+blending
+blends
+block
+blue
+BMP
+body
+bold
+booking
+bool
+Boston
+both
+bottom
+box
+boxes
+braces
+break
+breaks
+broad
+browsers
+buffer
+buffers
+build
+builds
+built
+bundled
+burdens
+busy
+but
+by
+bypass
+bypassing
+bytes
+calendar
+call
+called
+calling
+calls
+Cambridge
+can
+canonical
+canonicalised
+cap
+capabilities
+capacity
+caption
+card
+care
+case
+cast
+catch
+causing
+centre
+certain
+challenges
+chance
+change
+changes
+changing
+channel
+channels
+chapter
+char
+chart
+charts
+check
+checks
+Chicago
+chit-chat
+chosen
+chunk
+circle
+citation
+city
+claim
+class
+classes
+clause
+clauses
+clear
+clearing
+client
+clients
+close
+closed
+co-author
+code
+colon
+color
+color-coded
+colorize
+colorizer
+colors
+colour
+column
+columns
+combine
+combined
+combines
+combining
+comes
+command
+commands
+comment
+common
+communicate
+community
+compiled
+complement
+complete
+completely
+completeness
+completes
+completion
+complex
+compliant
+component
+components
+compositing
+composition
+compression
+computation
+computer
+concepts
+conclusion
+concurrent
+configurable
+congested
+congestion
+connect
+connected
+connection
+connections
+cons
+consider
+consisting
+consists
+construct
+constructed
+constructing
+constructor
+constructs
+consume
+contact
+contain
+containing
+contains
+contents
+contents
+continue
+continued
+contributors
+control
+controlled
+controller
+controller
+controlling
+controls
+controls
+conventions
+cook
+cooperation
+copy
+copyright
+core
+cores
+corollary
+correct
+correctly
+corresponding
+could
+couple
+coworkers
+CPU
+create
+creates
+creating
+cross-platform
+crucial
+cultures
+current
+currently
+custom
+customized
+cut
+data
+database
+datasets
+datum
+day
+days
+deal
+dealing
+decide
+decouple
+decoupled
+deeply
+def
+default
+define
+defines
+definition
+definitions
+delegate
+delete
+demo
+demonstrate
+demonstrations
+deployed
+describe
+describes
+design
+desktop
+desktops
+destination
+destinations
+destructor
+details
+detect
+determine
+determines
+developer
+developers
+development
+developments
+device
+devices
+diagram
+dialogs
+dictionary
+did
+difference
+differences
+different
+differs
+digital
+direct
+direct
+directions
+directly
+directory
+discuss
+display
+displaying
+displays
+distribute
+distribution
+disturbing
+divide
+do
+documentation
+documents
+does
+done
+down
+downLimit
+download
+downloaded
+downloading
+draw
+drawing
+drawn
+drop
+drop-in
+Duff
+during
+DVD
+dynamic
+dynamically
+dynamics
+each
+earlier
+easily
+editing
+editors
+education
+effect
+effectively
+effects
+either
+ellipse
+ellipses
+elliptical
+else
+email
+e-mail
+embedded
+emit
+emits
+empty
+enable
+enables
+encapsulates
+enclose
+end
+endnote
+endnotes
+end-user
+engineer
+engineering
+English
+enjoys
+enough
+ensure
+ensures
+entails
+enter
+entire
+entitled
+entries
+entry
+environment
+erases
+error
+errors
+especially
+established
+etc.
+Europe
+even
+evenly
+event
+events
+eventually
+every
+everyone
+example
+examples
+except
+exception
+excessive
+exclusive
+existing
+exists
+expand
+expected
+expense
+export
+exposes
+extend
+extended
+extending
+extensible
+extension
+external
+extra
+extract
+faces
+facilities
+factory
+fade
+failure
+fairness
+falls
+false
+family
+fashion
+fast
+faster
+features
+February
+feedback
+feel
+fetch
+fetching
+few
+fields
+figure
+figures
+file
+file name
+files
+filled
+filler
+final
+finally
+find
+fine
+finish
+finished
+first
+flow
+fly
+focus
+followed
+following
+font
+foot
+footnote
+footnotes
+for
+form
+format
+formats
+format-specific
+forms
+formula
+formulas
+forum
+found
+framework
+France
+from
+front
+full
+fully
+function
+functionality
+function-based
+functions
+future
+gain
+games
+gap
+general
+generic
+Germany
+get
+gill
+give
+given
+gives
+giving
+global
+go
+goes
+got
+gradient
+gradient-filled
+graph
+graphical
+graphics
+gray
+great
+greatly
+green
+grey
+group
+growing
+gui
+GUI
+hack
+had
+half
+Hamburg
+hand
+handing
+handle
+handler
+handlers
+handles
+handling
+happens
+hardware
+harmonica
+has
+have
+having
+he
+head
+header
+headers
+hear
+height
+help
+helper
+here
+high
+high-complexity
+high-level
+highlight
+highly
+hints
+his
+hold
+holder
+holding
+hole
+home
+horizontal
+host
+hosting
+hours
+Houston
+how
+however
+huge
+hyphen
+ID
+idea
+ideally
+if
+Illinois
+illustrate
+illustrated
+illustrates
+image
+images
+impact
+implement
+implementation
+implementations
+implemented
+implementing
+implements
+import
+important
+improvements
+in
+include
+included
+includes
+including
+inclusion
+incoming
+inconvenient
+indent
+index
+indicate
+inexpensively
+influence
+info
+information
+ingenious
+inherits
+initial
+initially
+inner
+input
+inspired
+install
+installs
+instance
+instead
+instructs
+integer
+integers
+integration
+intended
+intensive
+interest
+interests
+interface
+interfaces
+interfere
+internal
+interval
+into
+intriguing
+intro
+introduce
+introduced
+invalid
+invented
+inverse
+invocation
+involved
+Irish
+irregular
+is
+ISO
+ISPs
+issue
+issues
+it
+items
+iterate
+its
+itself
+job
+join
+JPEG
+jungle
+just
+Karaoke
+keep
+keeping
+key
+kind
+king
+known
+label
+labels
+landscape
+language
+large
+last
+later
+latest
+lawn
+layout
+lead
+leader
+leaders
+lean
+leaves
+leaving
+left
+lemma
+length
+less
+let
+level
+levels
+libraries
+library
+lies
+like
+likely
+limit
+limiting
+limits
+line
+linear
+lines
+linewidth
+link
+linked
+linking
+Linux
+list
+lists
+little
+lives
+load
+loading
+loads
+located
+location
+locations
+logo
+long
+longer
+look
+looked
+looking
+looks
+lookup
+lookups
+loop
+lout
+low
+lower-case
+low-level
+macro
+made
+magazine
+magic
+main
+major
+make
+makes
+making
+manage
+managed
+managing
+mandatory
+manipulate
+manipulation
+manner
+many
+map
+maps
+March
+margin
+mask
+masking
+Massachusetts
+match
+mathematical
+maximum
+may
+means
+meet
+member
+members
+memory
+merged
+method
+might
+milliseconds
+minimize
+minimum
+minor
+mix
+MNG
+mode
+model
+models
+modes
+modified
+module
+moments
+monitored
+monthly
+more
+most
+mostly
+move
+much
+multitude
+Munich
+must
+name
+named
+names
+necessary
+need
+needed
+needs
+network
+new
+news
+newsletter
+next
+nicely
+no
+none
+non-Qt
+non-trivial
+non-zero
+normally
+Norway
+not
+note
+notes
+nothing
+notifies
+notify
+now
+null
+number
+numbered
+numbering
+numbers
+Nydalen
+object
+objects
+obtain
+obtaining
+odd
+of
+off
+office
+offset
+offsets
+often
+old
+on
+once
+one
+ones
+online
+only
+on-screen
+onto
+opacity
+opaque
+open
+opens
+operates
+operating
+operation
+operations
+operator
+opportunity
+opposed
+optimize
+option
+optionally
+options
+or
+OR
+order
+ordinary
+original
+originally
+Oslo
+other
+otherwise
+our
+out
+outer
+outgoing
+output
+outside
+over
+overcoming
+overrides
+overview
+own
+owner
+owners
+pace
+Pacific
+package
+packages
+packets
+page
+pages
+paint
+painted
+painting
+paragraph
+paragraphs
+parameters
+parent
+Paris
+parse
+part
+partial
+partially
+particular
+partners
+parts
+party
+passed
+passing
+patches
+path
+pattern
+patterns
+pause
+PDF
+peek
+pending
+perform
+performed
+performs
+permission
+permutations
+personal
+pick
+pie
+pipe
+pixel
+pixels
+place
+places
+planning
+platform-independent
+platforms
+play
+players
+playing
+please
+pleasing
+plugin
+plugin-enabled
+plugins
+plus
+PNG
+pointer
+pop
+popular
+populates
+porter
+Porter
+portrait
+possibility
+possible
+potential
+potentially
+power
+powers
+preceded
+presence
+present
+prevent
+prevents
+previous
+previously
+primarily
+primary
+primitives
+printed
+printing
+prior
+probably
+problem
+process
+processes
+processing
+produce
+produced
+produces
+products
+programming
+programs
+project
+projects
+proof
+proper
+properly
+properties
+property
+proposed
+proposition
+pros
+protocols
+proud
+provide
+provided
+provides
+provision
+proxy
+public
+published
+punch
+punches
+pursuing
+put
+Qt
+Qtopia
+Qt-related
+quality
+quarter
+quarterly
+queried
+queries
+query
+question
+questions
+radial
+ragged
+range
+rate
+rate-controlled
+rates
+rather
+ratio
+raw
+read
+reader
+reading
+reads
+ready
+real
+realistic
+really
+real-time
+received
+recent
+recognized
+recommended
+recompile
+rectangle
+rectangular
+red
+redistribute
+reducing
+reference
+references
+reflect
+regardless
+regional
+register
+registered
+registration
+reimplement
+reimplementation
+reimplemented
+release
+released
+releases
+reliable
+rely
+remains
+remember
+removed
+removes
+repeatedly
+replace
+report
+represent
+represented
+represents
+reproduced
+requested
+require
+required
+requires
+resetting
+resides
+resolve
+respective
+respectively
+response
+rest
+restart
+result
+resulting
+resume
+return
+returning
+returns
+reuse
+revealing
+rich
+riches
+right
+roadshow
+role
+Roman
+round-trip
+router
+routers
+rule
+run
+runner
+runners
+running
+runs
+run-time
+sake
+sales
+salespeople
+same
+sample
+San Jose
+save
+saved
+saves
+say
+scalable
+scale
+scanline
+scanline-level
+scene
+scenes
+schedule
+school
+script
+seam
+seamless
+search
+searches
+searching
+second
+seconds
+section
+sections
+security
+see
+seen
+selection
+seminar
+seminars
+sending
+separated
+separates
+series
+service
+services
+set
+setting
+setup
+seven
+seventh
+several
+shade
+shadow
+shape
+shares
+shaves
+shine
+shorter
+should
+show
+shown
+shows
+side
+signal
+signals
+signature
+significantly
+similar
+similarily
+similarly
+simple
+simplest
+simplified
+simplifying
+simply
+simulate
+simultaneous
+since
+single
+size
+sizes
+slightly
+slope
+slot
+slowing
+small
+smaller
+so
+socket
+sockets
+software
+solutions
+solved
+some
+soon
+sort
+sorting
+source
+sources
+south
+space
+special
+specialized
+specific
+specifically
+specification
+specifications
+specified
+specify
+speed
+spend
+split
+SQL
+standard
+standards
+start
+starts
+starve
+state
+states
+static
+steady
+stealing
+step
+still
+stop
+stopwatch
+store
+stored
+stores
+straightforward
+stream
+string
+strings
+structure
+structured
+strut
+style
+styles
+styling
+subclass
+subclassing
+subdirectory
+subsection
+subsections
+succeeds
+success
+successful
+successfully
+such
+suggestion
+suggestions
+suitable
+support
+supported
+supports
+suppose
+supposes
+sure
+switch
+switches
+symbol
+symbols
+synonyms
+system
+systems
+table
+tables
+tags
+take
+takes
+tap
+target
+targets
+TCP
+team
+technically-focused
+technique
+technology
+template
+templates
+Texas
+text
+than
+that
+the
+their
+them
+then
+theorem
+there
+these
+they
+thickness
+thin
+third
+this
+those
+three
+throttling
+through
+tightly
+time
+timer
+times
+tiny
+tips
+title
+titles
+to
+together
+too
+top
+torrent
+total
+tour
+trademarks
+traffic
+training
+transaction
+transfer
+transferred
+transferring
+transfers
+translucency
+translucent
+transparency
+transparent
+travel
+traveled
+Trolltech
+true
+try
+turn
+twice
+two
+type
+typed
+typical
+typically
+unable
+under
+underlying
+understanding
+undoes
+unique
+united
+unlike
+unpack
+unsigned
+until
+untouched
+up
+update
+updated
+updates
+upload
+uploading
+uploads
+up-to-date
+us
+use
+used
+useful
+user
+user-friendly
+users
+uses
+using
+usual
+usually
+valid
+value
+values
+variable
+variation
+variety
+various
+vector
+venturing
+verifying
+versa
+version
+versions
+vertical
+very
+via
+vice
+virtual
+visual
+void
+VP
+waiting
+Wales
+want
+wants
+was
+way
+ways
+we
+web
+website
+well
+were
+what
+when
+whenever
+where
+whether
+which
+while
+whistle
+white
+who
+whole
+why
+widget
+widgets
+width
+widths
+will
+window
+windows
+wish
+with
+without
+word
+words
+work
+working
+works
+would
+wrap
+wrapper
+write
+writes
+writing
+writings
+written
+X
+X11
+XOR
+year
+years
+yes
+you
+your
+zero