Bump required Qt version to 5.12

This commit is contained in:
Jonas Kvinge
2022-01-29 01:33:40 +01:00
parent e511b2faf9
commit f8d2c7eba3
31 changed files with 24 additions and 165 deletions

View File

@@ -61,20 +61,6 @@ QStringList ImageUtils::SupportedImageFormats() {
}
QByteArrayList ImageUtils::ImageFormatsForMimeType(const QByteArray &mimetype) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
return QImageReader::imageFormatsForMimeType(mimetype);
#else
if (mimetype == "image/bmp") return QByteArrayList() << "BMP";
else if (mimetype == "image/gif") return QByteArrayList() << "GIF";
else if (mimetype == "image/jpeg") return QByteArrayList() << "JPG";
else if (mimetype == "image/png") return QByteArrayList() << "PNG";
else return QByteArrayList();
#endif
}
QPixmap ImageUtils::TryLoadPixmap(const QUrl &art_automatic, const QUrl &art_manual, const QUrl &url) {
QPixmap ret;

View File

@@ -37,7 +37,6 @@ class ImageUtils {
public:
static QStringList SupportedImageMimeTypes();
static QStringList SupportedImageFormats();
static QByteArrayList ImageFormatsForMimeType(const QByteArray &mimetype);
static QByteArray SaveImageToJpegData(const QImage &image = QImage());
static QByteArray FileToJpegData(const QString &filename);
static QPixmap TryLoadPixmap(const QUrl &automatic, const QUrl &manual, const QUrl &url = QUrl());

View File

@@ -36,11 +36,7 @@ QString MacAddress() {
!(netif.flags() & QNetworkInterface::IsUp) ||
!(netif.flags() & QNetworkInterface::IsRunning)
) { continue; }
if (ret.isEmpty()
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|| netif.type() == QNetworkInterface::Ethernet || netif.type() == QNetworkInterface::Wifi
#endif
) {
if (ret.isEmpty() || netif.type() == QNetworkInterface::Ethernet || netif.type() == QNetworkInterface::Wifi) {
ret = netif.hardwareAddress();
}
}

View File

@@ -20,9 +20,7 @@
#include <QString>
#include <QChar>
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
# include <QRandomGenerator>
#endif
#include <QRandomGenerator>
#include "randutils.h"
@@ -47,11 +45,7 @@ QString GetRandomString(const int len, const QString &UseCharacters) {
QString randstr;
for (int i = 0; i < len; ++i) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
const qint64 index = QRandomGenerator::global()->bounded(0, UseCharacters.length());
#else
const int index = qrand() % UseCharacters.length();
#endif
QChar nextchar = UseCharacters.at(index);
randstr.append(nextchar);
}