fix(registry): use QRandomGenerator with Qt 5.10+

This commit is contained in:
Oleg Shparber 2020-06-14 14:01:10 -04:00
parent 7fc6a1b046
commit b7276001fe

View File

@ -27,6 +27,9 @@
#include <QGuiApplication>
#include <QJsonArray>
#include <QJsonDocument>
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
#include <QRandomGenerator>
#endif
#include <QVariant>
#include <QXmlStreamReader>
@ -164,7 +167,11 @@ QUrl DocsetMetadata::feedUrl() const
QUrl DocsetMetadata::url() const
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return m_urls.at(QRandomGenerator::global()->bounded(m_urls.size()));
#else
return m_urls.at(qrand() % m_urls.size());
#endif
}
QList<QUrl> DocsetMetadata::urls() const