From 1978dbf52ddd64bf6b951f4b8156c19b525623d4 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sun, 23 Nov 2025 11:11:23 +0100 Subject: [PATCH] Modernize API usage --- src/editor/dialogs/backgroundpropertiesdialog.cpp | 2 +- src/editor/dialogs/gameinformationdialog.cpp | 2 +- src/editor/dialogs/soundpropertiesdialog.cpp | 12 ++++++------ src/editor/dialogs/spritepropertiesdialog.cpp | 4 ++-- src/editor/widgets/pathpointswidget.cpp | 8 +++----- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/editor/dialogs/backgroundpropertiesdialog.cpp b/src/editor/dialogs/backgroundpropertiesdialog.cpp index bf6081b..1036cc5 100644 --- a/src/editor/dialogs/backgroundpropertiesdialog.cpp +++ b/src/editor/dialogs/backgroundpropertiesdialog.cpp @@ -42,7 +42,7 @@ BackgroundPropertiesDialog::BackgroundPropertiesDialog(Background &background, P connect(m_ui->lineEditName, &QLineEdit::textChanged, this, &BackgroundPropertiesDialog::changed); - connect(m_ui->checkBoxTileset, &QCheckBox::stateChanged, + connect(m_ui->checkBoxTileset, &QCheckBox::checkStateChanged, this, &BackgroundPropertiesDialog::changed); } diff --git a/src/editor/dialogs/gameinformationdialog.cpp b/src/editor/dialogs/gameinformationdialog.cpp index 8ae20de..97a5d03 100644 --- a/src/editor/dialogs/gameinformationdialog.cpp +++ b/src/editor/dialogs/gameinformationdialog.cpp @@ -688,7 +688,7 @@ void GameInformationDialog::textItalic() void GameInformationDialog::textFamily(const QString &f) { QTextCharFormat fmt; - fmt.setFontFamily(f); + fmt.setFontFamilies({f}); mergeFormatOnWordOrSelection(fmt); } diff --git a/src/editor/dialogs/soundpropertiesdialog.cpp b/src/editor/dialogs/soundpropertiesdialog.cpp index baf3530..350eef4 100644 --- a/src/editor/dialogs/soundpropertiesdialog.cpp +++ b/src/editor/dialogs/soundpropertiesdialog.cpp @@ -70,21 +70,21 @@ SoundPropertiesDialog::SoundPropertiesDialog(Sound &sound, ProjectTreeModel &pro this, &SoundPropertiesDialog::changed); connect(m_ui->radioButtonMultimedia, &QRadioButton::toggled, this, &SoundPropertiesDialog::changed); - connect(m_ui->checkBoxChorus, &QCheckBox::stateChanged, + connect(m_ui->checkBoxChorus, &QCheckBox::checkStateChanged, this, &SoundPropertiesDialog::changed); - connect(m_ui->checkBoxFlanger, &QCheckBox::stateChanged, + connect(m_ui->checkBoxFlanger, &QCheckBox::checkStateChanged, this, &SoundPropertiesDialog::changed); - connect(m_ui->checkBoxGargle, &QCheckBox::stateChanged, + connect(m_ui->checkBoxGargle, &QCheckBox::checkStateChanged, this, &SoundPropertiesDialog::changed); - connect(m_ui->checkBoxEcho, &QCheckBox::stateChanged, + connect(m_ui->checkBoxEcho, &QCheckBox::checkStateChanged, this, &SoundPropertiesDialog::changed); - connect(m_ui->checkBoxReverb, &QCheckBox::stateChanged, + connect(m_ui->checkBoxReverb, &QCheckBox::checkStateChanged, this, &SoundPropertiesDialog::changed); connect(m_ui->horizontalSliderVolume, &QSlider::valueChanged, this, &SoundPropertiesDialog::changed); connect(m_ui->horizontalSliderPan, &QSlider::valueChanged, this, &SoundPropertiesDialog::changed); - connect(m_ui->checkBoxPreload, &QCheckBox::stateChanged, + connect(m_ui->checkBoxPreload, &QCheckBox::checkStateChanged, this, &SoundPropertiesDialog::changed); } diff --git a/src/editor/dialogs/spritepropertiesdialog.cpp b/src/editor/dialogs/spritepropertiesdialog.cpp index ef74135..35fbccd 100644 --- a/src/editor/dialogs/spritepropertiesdialog.cpp +++ b/src/editor/dialogs/spritepropertiesdialog.cpp @@ -55,9 +55,9 @@ SpritePropertiesDialog::SpritePropertiesDialog(Sprite &sprite, ProjectTreeModel this, &SpritePropertiesDialog::changed); connect(m_ui->spinBoxOriginY, &QSpinBox::valueChanged, this, &SpritePropertiesDialog::changed); - connect(m_ui->checkBoxPreciseCollisionChecking, &QCheckBox::stateChanged, + connect(m_ui->checkBoxPreciseCollisionChecking, &QCheckBox::checkStateChanged, this, &SpritePropertiesDialog::changed); - connect(m_ui->checkBoxSeparateCollisionMasks, &QCheckBox::stateChanged, + connect(m_ui->checkBoxSeparateCollisionMasks, &QCheckBox::checkStateChanged, this, &SpritePropertiesDialog::changed); } diff --git a/src/editor/widgets/pathpointswidget.cpp b/src/editor/widgets/pathpointswidget.cpp index 3cb75de..f4a0461 100644 --- a/src/editor/widgets/pathpointswidget.cpp +++ b/src/editor/widgets/pathpointswidget.cpp @@ -6,6 +6,7 @@ #include #include +#include #include "editorguiutils.h" @@ -106,11 +107,8 @@ void PathPointsWidget::paintEvent(QPaintEvent *event) painter.drawLine(point0.point, point1.point); }; - std::adjacent_find(std::cbegin(*m_points), std::cend(*m_points), - [&](const Path::Point &point0, const Path::Point &point1){ - drawLine(point0, point1); - return false; - }); + for (auto&& [p0, p1] : std::views::adjacent<2>(*m_points)) + drawLine(p0, p1); if (m_closed && m_points->size() >= 2) drawLine(m_points->back(), m_points->front());