mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-21 16:07:23 -06:00
Merge pull request #14593 from glassez/qt6-compat
Make current codebase more compatible with Qt6
This commit is contained in:
@@ -549,10 +549,10 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &)
|
||||
|
||||
const QModelIndexList selectedRows = m_ui->contentTreeView->selectionModel()->selectedRows(0);
|
||||
|
||||
const int priorityGroups = 3;
|
||||
const int priorityGroupSize = std::max((selectedRows.length() / priorityGroups), 1);
|
||||
const qsizetype priorityGroups = 3;
|
||||
const auto priorityGroupSize = std::max<qsizetype>((selectedRows.length() / priorityGroups), 1);
|
||||
|
||||
for (int i = 0; i < selectedRows.length(); ++i)
|
||||
for (qsizetype i = 0; i < selectedRows.length(); ++i)
|
||||
{
|
||||
auto priority = BitTorrent::DownloadPriority::Ignored;
|
||||
switch (i / priorityGroupSize)
|
||||
|
||||
@@ -143,7 +143,11 @@ bool PiecesBar::event(QEvent *e)
|
||||
return base::event(e);
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void PiecesBar::enterEvent(QEnterEvent *e)
|
||||
#else
|
||||
void PiecesBar::enterEvent(QEvent *e)
|
||||
#endif
|
||||
{
|
||||
m_hovered = true;
|
||||
base::enterEvent(e);
|
||||
|
||||
@@ -54,15 +54,19 @@ public:
|
||||
virtual void clear();
|
||||
|
||||
// QObject interface
|
||||
virtual bool event(QEvent*) override;
|
||||
virtual bool event(QEvent *e) override;
|
||||
|
||||
protected:
|
||||
// QWidget interface
|
||||
void enterEvent(QEvent*) override;
|
||||
void leaveEvent(QEvent*) override;
|
||||
void mouseMoveEvent(QMouseEvent*) override;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEnterEvent *e) override;
|
||||
#else
|
||||
void enterEvent(QEvent *e) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void requestImageUpdate();
|
||||
|
||||
QColor backgroundColor() const;
|
||||
|
||||
@@ -637,10 +637,10 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
|
||||
|
||||
const QModelIndexList selectedRows = m_ui->filesList->selectionModel()->selectedRows(0);
|
||||
|
||||
const int priorityGroups = 3;
|
||||
const int priorityGroupSize = std::max((selectedRows.length() / priorityGroups), 1);
|
||||
const qsizetype priorityGroups = 3;
|
||||
const auto priorityGroupSize = std::max<qsizetype>((selectedRows.length() / priorityGroups), 1);
|
||||
|
||||
for (int i = 0; i < selectedRows.length(); ++i)
|
||||
for (qsizetype i = 0; i < selectedRows.length(); ++i)
|
||||
{
|
||||
auto priority = BitTorrent::DownloadPriority::Ignored;
|
||||
switch (i / priorityGroupSize)
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <Windows.h>
|
||||
#include <Shellapi.h>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QtWin>
|
||||
#endif
|
||||
#else
|
||||
#include <QMimeDatabase>
|
||||
#include <QMimeType>
|
||||
@@ -118,7 +120,11 @@ namespace
|
||||
if (FAILED(hr))
|
||||
return {};
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
auto iconPixmap = QPixmap::fromImage(QImage::fromHICON(sfi.hIcon));
|
||||
#else
|
||||
QPixmap iconPixmap = QtWin::fromHICON(sfi.hIcon);
|
||||
#endif
|
||||
::DestroyIcon(sfi.hIcon);
|
||||
return iconPixmap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user