浏览代码

Move from qsrand to QRandomGenerator

Donald Carr 4 年之前
父节点
当前提交
bfb3991002
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/picturemodel.cpp

+ 2 - 1
src/picturemodel.cpp

@@ -18,6 +18,7 @@
 
 #include "picturemodel.h"
 
+#include <QRandomGenerator>
 #include <QDir>
 #include <QDebug>
 #include <QCoreApplication>
@@ -460,7 +461,7 @@ QVariant PictureModel::data(const QModelIndex &index, int role) const
 int PictureModel::requestIndex(int index) const
 {
     if (index == -1) {
-        index = d->itemCount() == 0 ? 0 : qrand() % d->itemCount();
+        index = d->itemCount() == 0 ? 0 : QRandomGenerator::global()->generate() % d->itemCount();
     }
 
     if (!d->fsTree) {