ENH: Add completion to editor for files and file paths.

This commit is contained in:
Clinton Stimpson 2007-11-09 01:14:37 -05:00
parent 38d15310a3
commit c5b01a7daf
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,8 @@
#include <QDialog> #include <QDialog>
#include <QLabel> #include <QLabel>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QDirModel>
#include <QCompleter>
static QRegExp AdvancedRegExp[2] = { QRegExp("(false)"), QRegExp("(true|false)") }; static QRegExp AdvancedRegExp[2] = { QRegExp("(false)"), QRegExp("(true|false)") };
@ -438,6 +440,15 @@ QCMakeCachePathEditor::QCMakeCachePathEditor(bool fp, QWidget* p)
this->ToolButton->setCursor(QCursor(Qt::ArrowCursor)); this->ToolButton->setCursor(QCursor(Qt::ArrowCursor));
QObject::connect(this->ToolButton, SIGNAL(clicked(bool)), QObject::connect(this->ToolButton, SIGNAL(clicked(bool)),
this, SLOT(chooseFile())); this, SLOT(chooseFile()));
QCompleter* comp = new QCompleter(this);
QDirModel* model = new QDirModel(comp);
if(!fp)
{
// only dirs
model->setFilter(QDir::AllDirs | QDir::Drives);
}
comp->setModel(model);
this->setCompleter(comp);
} }
void QCMakeCachePathEditor::resizeEvent(QResizeEvent* e) void QCMakeCachePathEditor::resizeEvent(QResizeEvent* e)