Raise minimum Qt version to 5.14

This commit is contained in:
Vladimir Golovnev (Glassez)
2021-05-25 19:58:43 +03:00
parent 0c71756009
commit 97c7f3bc67
35 changed files with 80 additions and 145 deletions

View File

@@ -241,7 +241,7 @@ void FileSystemPathEdit::setFileNameFilter(const QString &val)
}
else
{
QStringList filters = filterString.split(QLatin1Char(' '), QString::SkipEmptyParts);
QStringList filters = filterString.split(QLatin1Char(' '), Qt::SkipEmptyParts);
d->m_editor->setFilenameFilters(filters);
}
}

View File

@@ -107,7 +107,7 @@ QValidator::State Private::FileSystemPathValidator::validate(QString &input, int
// we test path components from beginning to the one with cursor location in strict mode
// and the one with cursor and beyond in non-strict mode
QVector<QStringRef> components = input.splitRef(QDir::separator(), QString::KeepEmptyParts);
QVector<QStringRef> components = input.splitRef(QDir::separator(), Qt::KeepEmptyParts);
// find index of the component that contains pos
int componentWithCursorIndex = 0;
int pathLength = 0;

View File

@@ -1154,7 +1154,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
if (mimeData->hasText())
{
const bool useTorrentAdditionDialog {AddNewTorrentDialog::isEnabled()};
const QStringList lines {mimeData->text().split('\n', QString::SkipEmptyParts)};
const QStringList lines {mimeData->text().split('\n', Qt::SkipEmptyParts)};
for (QString line : lines)
{

View File

@@ -718,7 +718,7 @@ void OptionsDialog::saveOptions()
RSS::Session::instance()->setMaxArticlesPerFeed(m_ui->spinRSSMaxArticlesPerFeed->value());
RSS::Session::instance()->setProcessingEnabled(m_ui->checkRSSEnable->isChecked());
RSS::AutoDownloader::instance()->setProcessingEnabled(m_ui->checkRSSAutoDownloaderEnable->isChecked());
RSS::AutoDownloader::instance()->setSmartEpisodeFilters(m_ui->textSmartEpisodeFilters->toPlainText().split('\n', QString::SplitBehavior::SkipEmptyParts));
RSS::AutoDownloader::instance()->setSmartEpisodeFilters(m_ui->textSmartEpisodeFilters->toPlainText().split('\n', Qt::SkipEmptyParts));
RSS::AutoDownloader::instance()->setDownloadRepacks(m_ui->checkSmartFilterDownloadRepacks->isChecked());
auto session = BitTorrent::Session::instance();

View File

@@ -502,15 +502,9 @@ void PeerListWidget::wheelEvent(QWheelEvent *event)
{
// Shift + scroll = horizontal scroll
event->accept();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QWheelEvent scrollHEvent(event->position(), event->globalPosition()
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
, event->modifiers(), event->phase(), event->inverted(), event->source());
#else
QWheelEvent scrollHEvent(event->pos(), event->globalPos()
, event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal);
#endif
QTreeView::wheelEvent(&scrollHEvent);
return;
}

View File

@@ -59,7 +59,7 @@ void SearchSortModel::setNameFilter(const QString &searchTerm)
}
else
{
m_searchTermWords = searchTerm.split(QLatin1Char(' '), QString::SkipEmptyParts);
m_searchTermWords = searchTerm.split(QLatin1Char(' '), Qt::SkipEmptyParts);
}
}

View File

@@ -503,7 +503,7 @@ void TorrentContentModel::setupModelData(const BitTorrent::TorrentInfo &info)
const QString path = Utils::Fs::toUniformPath(info.filePath(i));
// Iterate of parts of the path to create necessary folders
QVector<QStringRef> pathFolders = path.splitRef('/', QString::SkipEmptyParts);
QVector<QStringRef> pathFolders = path.splitRef('/', Qt::SkipEmptyParts);
pathFolders.removeLast();
for (const QStringRef &pathPartRef : asConst(pathFolders))

View File

@@ -212,7 +212,7 @@ void TorrentCreatorDialog::onCreateButtonClicked()
, m_ui->txtComment->toPlainText()
, m_ui->lineEditSource->text()
, trackers
, m_ui->URLSeedsList->toPlainText().split('\n', QString::SkipEmptyParts)
, m_ui->URLSeedsList->toPlainText().split('\n', Qt::SkipEmptyParts)
};
// run the creator thread

View File

@@ -632,9 +632,9 @@ QSet<BitTorrent::TorrentID> TrackerFiltersList::getTorrentIDs(const int row) con
case TRACKERLESS_ROW:
return m_trackers.value(NULL_HOST);
case ERROR_ROW:
return List::toSet(m_errors.keys());
return {m_errors.keyBegin(), m_errors.keyEnd()};
case WARNING_ROW:
return List::toSet(m_warnings.keys());
return {m_warnings.keyBegin(), m_warnings.keyEnd()};
default:
return m_trackers.value(trackerFromRow(row));
}

View File

@@ -721,7 +721,7 @@ QStringList TransferListWidget::askTagsForSelection(const QString &dialogTitle)
this, dialogTitle, tr("Comma-separated tags:"), QLineEdit::Normal, "", &ok).trimmed();
if (!ok || tagsInput.isEmpty())
return {};
tags = tagsInput.split(',', QString::SkipEmptyParts);
tags = tagsInput.split(',', Qt::SkipEmptyParts);
for (QString &tag : tags)
{
tag = tag.trimmed();
@@ -1163,15 +1163,9 @@ void TransferListWidget::wheelEvent(QWheelEvent *event)
{
// Shift + scroll = horizontal scroll
event->accept();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QWheelEvent scrollHEvent(event->position(), event->globalPosition()
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
, event->modifiers(), event->phase(), event->inverted(), event->source());
#else
QWheelEvent scrollHEvent(event->pos(), event->globalPos()
, event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal);
#endif
QTreeView::wheelEvent(&scrollHEvent);
return;
}

View File

@@ -48,10 +48,6 @@
#include <QWidget>
#include <QWindow>
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) && defined(Q_OS_WIN)
#include <QDesktopWidget>
#endif
#include "base/utils/fs.h"
#include "base/utils/version.h"
@@ -65,26 +61,8 @@ void Utils::Gui::resize(QWidget *widget, const QSize &newSize)
qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
Q_UNUSED(widget);
return 1;
#else
if (!widget)
return 1;
#ifdef Q_OS_WIN
const int screenNumber = qApp->desktop()->screenNumber(widget);
const QScreen *screen = QApplication::screens()[screenNumber];
// Workaround for QScreen::physicalDotsPerInch() that could return
// values that are smaller than the normal 96 DPI on Windows
const qreal physicalDPI = qMax<qreal>(screen->physicalDotsPerInch(), 96);
return (screen->logicalDotsPerInch() / physicalDPI);
#elif defined(Q_OS_MACOS)
return 1;
#else
return widget->devicePixelRatioF();
#endif // Q_OS_WIN
#endif // QT_VERSION
}
QPixmap Utils::Gui::scaledPixmap(const QIcon &icon, const QWidget *widget, const int height)