Skip to content

Commit

Permalink
Merge pull request #13028 from Holzhaus/qasconst-fixes
Browse files Browse the repository at this point in the history
fix: Replace deprecated `qAsConst` with `std::as_const`
  • Loading branch information
daschuer authored Mar 31, 2024
2 parents 4bbb5da + c5e3480 commit 2145f5f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/controllers/dlgprefcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ void DlgPrefController::slotShowMapping(std::shared_ptr<LegacyControllerMapping>
if (pLayout != nullptr && !settings.isEmpty()) {
m_ui.groupBoxSettings->layout()->addWidget(pLayout->build(m_ui.groupBoxSettings));

for (const auto& setting : qAsConst(settings)) {
for (const auto& setting : std::as_const(settings)) {
connect(setting.get(),
&AbstractLegacyControllerSetting::changed,
this,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/legacycontrollermapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void LegacyControllerMapping::loadSettings(UserSettingsPointer pConfig,
QList<ConfigKey> definedSettings = pConfig->getKeysWithGroup(controllerKey);

QList<QString> availableSettingKeys;
for (const auto& pSetting : qAsConst(availableSettings)) {
for (const auto& pSetting : std::as_const(availableSettings)) {
availableSettingKeys.append(pSetting->variableName());
}

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/legacycontrollermapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class LegacyControllerMapping {
VERIFY_OR_DEBUG_ASSERT(option->valid()) {
return false;
}
for (const auto& setting : qAsConst(m_settings)) {
for (const auto& setting : std::as_const(m_settings)) {
if (*setting == *option) {
qWarning() << "Mapping setting duplication detected for "
"setting with name"
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/legacycontrollersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void LegacyControllerEnumSetting::parse(const QString& in, bool* ok) {
save();

size_t pos = 0;
for (const auto& value : qAsConst(m_options)) {
for (const auto& value : std::as_const(m_options)) {
if (std::get<0>(value) == in) {
if (ok != nullptr) {
*ok = true;
Expand All @@ -213,7 +213,7 @@ void LegacyControllerEnumSetting::parse(const QString& in, bool* ok) {
QWidget* LegacyControllerEnumSetting::buildInputWidget(QWidget* pParent) {
auto* pComboBox = new QComboBox(pParent);

for (const auto& value : qAsConst(m_options)) {
for (const auto& value : std::as_const(m_options)) {
pComboBox->addItem(std::get<1>(value));
}
pComboBox->setCurrentIndex(static_cast<int>(m_editedValue));
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/legacycontrollersettingsfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LegacyControllerSettingBuilder {
/// @return an instance if a a supported setting has been found, null
/// otherwise
static AbstractLegacyControllerSetting* build(const QDomElement& element) {
for (const auto& settingType : qAsConst(instance()->m_supportedSettings)) {
for (const auto& settingType : std::as_const(instance()->m_supportedSettings)) {
if (settingType.matcher(element)) {
return settingType.builder(element);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ControllerScriptEngineLegacy::setScriptFiles(
void ControllerScriptEngineLegacy::setSettings(
const QList<std::shared_ptr<AbstractLegacyControllerSetting>>& settings) {
m_settings.clear();
for (const auto& pSetting : qAsConst(settings)) {
for (const auto& pSetting : std::as_const(settings)) {
QString name = pSetting->variableName();
VERIFY_OR_DEBUG_ASSERT(!name.isEmpty()) {
continue;
Expand Down

0 comments on commit 2145f5f

Please sign in to comment.