summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
authorSankhesh Jhaveri <sankhesh.jhaveri@kitware.com>2020-12-17 23:28:24 (GMT)
committerBrad King <brad.king@kitware.com>2021-01-05 16:03:30 (GMT)
commit020b2766f31c19f6a5953e3365641aeba06c3552 (patch)
tree3e8fa9c0b06124871ca7f9200f9b276aef9b7e35 /Source/QtDialog
parent684dcdbc5bb6998606bdb8631cbab5e1905b762c (diff)
downloadCMake-020b2766f31c19f6a5953e3365641aeba06c3552.zip
CMake-020b2766f31c19f6a5953e3365641aeba06c3552.tar.gz
CMake-020b2766f31c19f6a5953e3365641aeba06c3552.tar.bz2
cmake-gui: Replace obsolete QDirModel with QFileSystemModel
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx23
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index e68faba..45fd425 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -1,17 +1,13 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-// FIXME: Port to QFileSystemModel from the deprecated QDirModel.
-// Be sure completion works when incrementally editing existing paths.
-#define QT_DEPRECATED_WARNINGS_SINCE QT_VERSION_CHECK(5, 14, 0)
-
#include "QCMakeWidgets.h"
#include <utility>
-#include <QDirModel>
#include <QFileDialog>
#include <QFileInfo>
+#include <QFileSystemModel>
#include <QResizeEvent>
#include <QToolButton>
@@ -93,20 +89,20 @@ void QCMakePathEditor::chooseFile()
}
}
-// use same QDirModel for all completers
-static QDirModel* fileDirModel()
+// use same QFileSystemModel for all completers
+static QFileSystemModel* fileDirModel()
{
- static QDirModel* m = nullptr;
+ static QFileSystemModel* m = nullptr;
if (!m) {
- m = new QDirModel();
+ m = new QFileSystemModel();
}
return m;
}
-static QDirModel* pathDirModel()
+static QFileSystemModel* pathDirModel()
{
- static QDirModel* m = nullptr;
+ static QFileSystemModel* m = nullptr;
if (!m) {
- m = new QDirModel();
+ m = new QFileSystemModel();
m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);
}
return m;
@@ -115,8 +111,9 @@ static QDirModel* pathDirModel()
QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs)
: QCompleter(o)
{
- QDirModel* m = dirs ? pathDirModel() : fileDirModel();
+ QFileSystemModel* m = dirs ? pathDirModel() : fileDirModel();
this->setModel(m);
+ m->setRootPath(QString());
}
QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const