From 854a109a0fc4bd12480918171acae1979489049d Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 18 Oct 2024 22:25:31 +1000 Subject: [PATCH] Qt: Qt 6.8 deprecation fixes --- src/duckstation-qt/gamelistmodel.cpp | 13 ++++++++----- src/duckstation-qt/gamesummarywidget.cpp | 2 +- src/duckstation-qt/mainwindow.cpp | 2 +- src/util/opengl_device.cpp | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/duckstation-qt/gamelistmodel.cpp b/src/duckstation-qt/gamelistmodel.cpp index e9cb77547..ce496b384 100644 --- a/src/duckstation-qt/gamelistmodel.cpp +++ b/src/duckstation-qt/gamelistmodel.cpp @@ -437,7 +437,9 @@ QVariant GameListModel::data(const QModelIndex& index, int role, const GameList: if (ge->dbentry && ge->dbentry->release_date != 0) { return QStringLiteral("%1").arg( - QDateTime::fromSecsSinceEpoch(static_cast(ge->dbentry->release_date), Qt::UTC).date().year()); + QDateTime::fromSecsSinceEpoch(static_cast(ge->dbentry->release_date), QTimeZone::utc()) + .date() + .year()); } else { @@ -514,10 +516,11 @@ QVariant GameListModel::data(const QModelIndex& index, int role, const GameList: return ge->dbentry ? QtUtils::StringViewToQString(ge->dbentry->genre) : QString(); case Column_Year: - return ge->dbentry ? QDateTime::fromSecsSinceEpoch(static_cast(ge->dbentry->release_date), Qt::UTC) - .date() - .year() : - 0; + return ge->dbentry ? + QDateTime::fromSecsSinceEpoch(static_cast(ge->dbentry->release_date), QTimeZone::utc()) + .date() + .year() : + 0; case Column_Players: return static_cast(ge->dbentry ? ge->dbentry->max_players : 0); diff --git a/src/duckstation-qt/gamesummarywidget.cpp b/src/duckstation-qt/gamesummarywidget.cpp index a19cf925c..b7eddc74f 100644 --- a/src/duckstation-qt/gamesummarywidget.cpp +++ b/src/duckstation-qt/gamesummarywidget.cpp @@ -100,7 +100,7 @@ void GameSummaryWidget::populateUi(const std::string& path, const std::string& s QString release_info; if (entry->release_date != 0) release_info = - tr("Released %1").arg(QDateTime::fromSecsSinceEpoch(entry->release_date, Qt::UTC).date().toString()); + tr("Released %1").arg(QDateTime::fromSecsSinceEpoch(entry->release_date, QTimeZone::utc()).date().toString()); if (entry->min_players != 0) { if (!release_info.isEmpty()) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 5c394c55a..296606cc2 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1078,7 +1078,7 @@ std::optional MainWindow::promptForResumeState(const std::string& save_sta msgbox.setWindowModality(Qt::WindowModal); msgbox.setText(tr("A resume save state was found for this game, saved at:\n\n%1.\n\nDo you want to load this state, " "or start from a fresh boot?") - .arg(QDateTime::fromSecsSinceEpoch(sd.ModificationTime, Qt::UTC).toLocalTime().toString())); + .arg(QDateTime::fromSecsSinceEpoch(sd.ModificationTime, QTimeZone::utc()).toLocalTime().toString())); QPushButton* load = msgbox.addButton(tr("Load State"), QMessageBox::AcceptRole); QPushButton* boot = msgbox.addButton(tr("Fresh Boot"), QMessageBox::RejectRole); diff --git a/src/util/opengl_device.cpp b/src/util/opengl_device.cpp index 7afd10489..e929da63d 100644 --- a/src/util/opengl_device.cpp +++ b/src/util/opengl_device.cpp @@ -556,8 +556,8 @@ bool OpenGLSwapChain::ResizeBuffers(u32 new_width, u32 new_height, float new_sca if (m_window_info.surface_width == new_width && m_window_info.surface_height == new_height) return true; - m_window_info.surface_width = new_width; - m_window_info.surface_height = new_height; + m_window_info.surface_width = static_cast(new_width); + m_window_info.surface_height = static_cast(new_height); OpenGLDevice::GetContext()->ResizeSurface(m_window_info, m_surface_handle); return true;