Add auto-completion on the dictionary path

This commit is contained in:
Olivier Teulière 2012-01-29 23:32:28 +01:00
parent 84c4937d8d
commit ea4b4396a8
2 changed files with 24 additions and 0 deletions

View file

@ -28,6 +28,8 @@
#include <QtCore/QTextStream>
#include <QtCore/QSet>
#include <QtCore/QList>
#include <QtGui/QCompleter>
#include <QtGui/QFileSystemModel>
#include "dic_wizard.h"
#include "qtcommon.h"
@ -72,6 +74,19 @@ WizardInfoPage::WizardInfoPage(QWidget *parent) : QWizardPage(parent)
registerField("dicName*", editDicName);
registerField("genDic*", editGenDic);
registerField("wordList*", editWordList);
// Auto-completion on the paths
QCompleter *completer1 = new QCompleter(this);
QFileSystemModel *model1 = new QFileSystemModel(this);
model1->setRootPath(QDir::currentPath());
completer1->setModel(model1);
editGenDic->setCompleter(completer1);
QCompleter *completer2 = new QCompleter(this);
QFileSystemModel *model2 = new QFileSystemModel(this);
model2->setRootPath(QDir::currentPath());
completer2->setModel(model2);
editWordList->setCompleter(completer2);
}

View file

@ -24,6 +24,8 @@
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include <QtCore/QStringList>
#include <QtGui/QCompleter>
#include <QtGui/QFileSystemModel>
#include "prefs_dialog.h"
#include "game_exception.h"
@ -61,6 +63,13 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
"Use a value of -1 to disable the alert.\n"
"Changing this value will reset the timer."));
// Auto-completion on the dictionary path
QCompleter *completer = new QCompleter(this);
QFileSystemModel *model = new QFileSystemModel(completer);
model->setRootPath(QDir::currentPath());
completer->setModel(model);
lineEditIntfDicPath->setCompleter(completer);
try
{
// Interface settings