Qt: Qt 6.8 deprecation fixes

This commit is contained in:
Stenzek 2024-10-18 22:25:31 +10:00
parent 86a28d5dc0
commit 854a109a0f
No known key found for this signature in database
4 changed files with 12 additions and 9 deletions

View File

@ -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<qint64>(ge->dbentry->release_date), Qt::UTC).date().year());
QDateTime::fromSecsSinceEpoch(static_cast<qint64>(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<qint64>(ge->dbentry->release_date), Qt::UTC)
.date()
.year() :
0;
return ge->dbentry ?
QDateTime::fromSecsSinceEpoch(static_cast<qint64>(ge->dbentry->release_date), QTimeZone::utc())
.date()
.year() :
0;
case Column_Players:
return static_cast<int>(ge->dbentry ? ge->dbentry->max_players : 0);

View File

@ -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())

View File

@ -1078,7 +1078,7 @@ std::optional<bool> 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);

View File

@ -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<u16>(new_width);
m_window_info.surface_height = static_cast<u16>(new_height);
OpenGLDevice::GetContext()->ResizeSurface(m_window_info, m_surface_handle);
return true;