summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/QCMakeCacheView.cxx
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2008-02-15 00:58:31 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2008-02-15 00:58:31 (GMT)
commitd0d67d00153cad4f460eab7b930f7c2d3572b498 (patch)
tree5d69e530830aaaa88e98eee9cbd7b4e27338b34c /Source/QtDialog/QCMakeCacheView.cxx
parentdf3169273a3333efe8ecb45da51e4c53b5d27fe9 (diff)
downloadCMake-d0d67d00153cad4f460eab7b930f7c2d3572b498.zip
CMake-d0d67d00153cad4f460eab7b930f7c2d3572b498.tar.gz
CMake-d0d67d00153cad4f460eab7b930f7c2d3572b498.tar.bz2
ENH: Convert native paths from QFileDialog and QDirModel/QCompleter.
BUG: Block possible completion loop.
Diffstat (limited to 'Source/QtDialog/QCMakeCacheView.cxx')
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx31
1 files changed, 19 insertions, 12 deletions
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 776e10b..74492bf 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -27,7 +27,6 @@
#include <QKeyEvent>
#include <QMenu>
#include <QDirModel>
-#include <QCompleter>
static QRegExp AdvancedRegExp[2] = { QRegExp("(false)"), QRegExp("(true|false)") };
@@ -460,20 +459,13 @@ QCMakeCacheFileEditor::QCMakeCacheFileEditor(QWidget* p, const QString& var)
QCMakeCacheFilePathEditor::QCMakeCacheFilePathEditor(QWidget* p, const QString& var)
: QCMakeCacheFileEditor(p, var)
{
- QCompleter* comp = new QCompleter(this);
- QDirModel* model = new QDirModel(comp);
- comp->setModel(model);
- this->setCompleter(comp);
+ this->setCompleter(new QCMakeFileCompleter(this, false));
}
QCMakeCachePathEditor::QCMakeCachePathEditor(QWidget* p, const QString& var)
: QCMakeCacheFileEditor(p, var)
{
- QCompleter* comp = new QCompleter(this);
- QDirModel* model = new QDirModel(comp);
- model->setFilter(QDir::AllDirs | QDir::Drives);
- comp->setModel(model);
- this->setCompleter(comp);
+this->setCompleter(new QCMakeFileCompleter(this, true));
}
void QCMakeCacheFileEditor::resizeEvent(QResizeEvent* e)
@@ -504,7 +496,7 @@ void QCMakeCacheFilePathEditor::chooseFile()
if(!path.isEmpty())
{
- this->setText(path);
+ this->setText(QDir::fromNativeSeparators(path));
}
}
@@ -525,8 +517,23 @@ void QCMakeCachePathEditor::chooseFile()
path = QFileDialog::getExistingDirectory(this, title, this->text());
if(!path.isEmpty())
{
- this->setText(path);
+ this->setText(QDir::fromNativeSeparators(path));
}
}
+QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs)
+ : QCompleter(o)
+{
+ QDirModel* model = new QDirModel(this);
+ if(dirs)
+ {
+ model->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);
+ }
+ this->setModel(model);
+}
+
+QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const
+{
+ return QDir::fromNativeSeparators(QCompleter::pathFromIndex(idx));
+}