From 48b292eceefe1b3ba8ed3622eae1032c2ad9ce65 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 3 Jul 2020 11:00:34 -0400 Subject: [PATCH] CResourceBrowser: Make use of ranged for --- src/Editor/ResourceBrowser/CResourceBrowser.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Editor/ResourceBrowser/CResourceBrowser.cpp b/src/Editor/ResourceBrowser/CResourceBrowser.cpp index 470c4c46..c6d8ec6f 100644 --- a/src/Editor/ResourceBrowser/CResourceBrowser.cpp +++ b/src/Editor/ResourceBrowser/CResourceBrowser.cpp @@ -248,13 +248,12 @@ void CResourceBrowser::CreateFilterCheckboxes() std::list TypeList; CResTypeInfo::GetAllTypesInGame(mpStore->Game(), TypeList); - for (auto Iter = TypeList.begin(); Iter != TypeList.end(); Iter++) + for (auto* type : TypeList) { - CResTypeInfo *pType = *Iter; QCheckBox *pCheck = new QCheckBox(this); pCheck->setFont(mFilterBoxFont); - pCheck->setText(TO_QSTRING(pType->TypeName())); - mTypeList << SResourceType { pType, pCheck }; + pCheck->setText(TO_QSTRING(type->TypeName())); + mTypeList << SResourceType{type, pCheck}; } std::sort(mTypeList.begin(), mTypeList.end(), [](const SResourceType& rkLeft, const SResourceType& rkRight) { @@ -305,15 +304,13 @@ void CResourceBrowser::AddCreateAssetMenuActions(QMenu* pMenu) std::list TypeInfos; CResTypeInfo::GetAllTypesInGame(mpStore->Game(), TypeInfos); - for (auto Iter = TypeInfos.begin(); Iter != TypeInfos.end(); Iter++) + for (const auto* typeInfo : TypeInfos) { - CResTypeInfo* pTypeInfo = *Iter; - - if (pTypeInfo->CanBeCreated()) + if (typeInfo->CanBeCreated()) { - QString TypeName = TO_QSTRING( pTypeInfo->TypeName() ); + QString TypeName = TO_QSTRING(typeInfo->TypeName()); QAction* pAction = pMenu->addAction(TypeName, this, &CResourceBrowser::OnCreateAssetAction); - pAction->setProperty("TypeInfo", QVariant((int) pTypeInfo->Type())); + pAction->setProperty("TypeInfo", QVariant(static_cast(typeInfo->Type()))); } } }