summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-16 11:17:01 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-12-16 11:17:08 (GMT)
commit80148daa2c5f9d95114953f4ddd501c9e9a8ae21 (patch)
tree66cbc5b30eccb00a2bcc037fbfe846745ebc5073 /Source
parent4098b2beb6e70ffaed7f0e66317f3a10396ab092 (diff)
parent854f5ea1cbc7f3b015150e91f6b6371004128faa (diff)
downloadCMake-80148daa2c5f9d95114953f4ddd501c9e9a8ae21.zip
CMake-80148daa2c5f9d95114953f4ddd501c9e9a8ae21.tar.gz
CMake-80148daa2c5f9d95114953f4ddd501c9e9a8ae21.tar.bz2
Merge topic 'cmake-gui-completion'
854f5ea1cb cmake-gui: Restore completion during path editing Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5619
Diffstat (limited to 'Source')
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx23
1 files changed, 14 insertions, 9 deletions
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index 1fc839f..e68faba 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -1,12 +1,17 @@
/* 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>
@@ -88,20 +93,20 @@ void QCMakePathEditor::chooseFile()
}
}
-// use same QFileSystemModel for all completers
-static QFileSystemModel* fileDirModel()
+// use same QDirModel for all completers
+static QDirModel* fileDirModel()
{
- static QFileSystemModel* m = nullptr;
+ static QDirModel* m = nullptr;
if (!m) {
- m = new QFileSystemModel();
+ m = new QDirModel();
}
return m;
}
-static QFileSystemModel* pathDirModel()
+static QDirModel* pathDirModel()
{
- static QFileSystemModel* m = nullptr;
+ static QDirModel* m = nullptr;
if (!m) {
- m = new QFileSystemModel();
+ m = new QDirModel();
m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);
}
return m;
@@ -110,7 +115,7 @@ static QFileSystemModel* pathDirModel()
QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs)
: QCompleter(o)
{
- QFileSystemModel* m = dirs ? pathDirModel() : fileDirModel();
+ QDirModel* m = dirs ? pathDirModel() : fileDirModel();
this->setModel(m);
}