Browse Source

Merge topic 'avoid-qt5-deprecation-warnings'

0fc1818831 QCMakeWidgets: replace QDirModel
736fb34294 QCMake: use loadRelaxed if available

Acked-by: Kitware Robot <[email protected]>
Merge-request: !4894
Brad King 5 years ago
parent
commit
268aaf4d58
2 changed files with 13 additions and 9 deletions
  1. 4 0
      Source/QtDialog/QCMake.cxx
  2. 9 9
      Source/QtDialog/QCMakeWidgets.cxx

+ 4 - 0
Source/QtDialog/QCMake.cxx

@@ -340,7 +340,11 @@ void QCMake::interrupt()
 
 bool QCMake::interruptCallback()
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
   return this->InterruptFlag.load();
+#else
+  return this->InterruptFlag.loadRelaxed();
+#endif
 }
 
 void QCMake::progressCallback(const std::string& msg, float percent)

+ 9 - 9
Source/QtDialog/QCMakeWidgets.cxx

@@ -4,9 +4,9 @@
 
 #include <utility>
 
-#include <QDirModel>
 #include <QFileDialog>
 #include <QFileInfo>
+#include <QFileSystemModel>
 #include <QResizeEvent>
 #include <QToolButton>
 
@@ -88,20 +88,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;
@@ -110,7 +110,7 @@ static QDirModel* pathDirModel()
 QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs)
   : QCompleter(o)
 {
-  QDirModel* m = dirs ? pathDirModel() : fileDirModel();
+  QFileSystemModel* m = dirs ? pathDirModel() : fileDirModel();
   this->setModel(m);
 }