From fdcb0b770cedc46e703006ed3fcabc1ebd0304d9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 5 Jul 2020 10:03:50 -0400 Subject: [PATCH] CTweakEditor: Make use of STL equivalents over << where applicable More recognizable with regards to behavior being performed. While we're at it, we can preallocate the backing asset QVector ahead of time. --- src/Editor/CTweakEditor.cpp | 7 +++++-- src/Editor/WorldEditor/CWorldEditor.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Editor/CTweakEditor.cpp b/src/Editor/CTweakEditor.cpp index 8e49d295..991447a5 100644 --- a/src/Editor/CTweakEditor.cpp +++ b/src/Editor/CTweakEditor.cpp @@ -116,9 +116,12 @@ void CTweakEditor::OnProjectChanged(CGameProject* pNewProject) // Create tweak list if (pNewProject != nullptr) { - for (CTweakData* pTweakData : pNewProject->TweakManager()->TweakObjects()) + const auto& tweakObjects = pNewProject->TweakManager()->TweakObjects(); + mTweakAssets.reserve(static_cast(tweakObjects.size())); + + for (CTweakData* tweakData : tweakObjects) { - mTweakAssets << pTweakData; + mTweakAssets.push_back(tweakData); } } diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index 4e5f660b..8cd5a3d2 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -59,8 +59,11 @@ CWorldEditor::CWorldEditor(QWidget *parent) ui->ResourceBrowserContainer->setLayout(pLayout); // Initialize splitter - QList SplitterSizes; - SplitterSizes << width() * 0.25 << width() * 0.53 << width() * 0.22; + const QList SplitterSizes{ + static_cast(width() * 0.25), + static_cast(width() * 0.53), + static_cast(width() * 0.22), + }; ui->splitter->setSizes(SplitterSizes); // Initialize UI stuff