From b40672ab5c48b577b31371c159e60d330fdd7ce5 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 5 Sep 2018 20:53:24 +0200 Subject: [PATCH] clang-tidy: Avoid another warning about potential memory leak This is a false positive (since the newly created QFormLayout takes a widget as its parent), however some slight rearrangement of code shuts up clang-tidy without resorting to NOLINT. --- src/qtui/coreconfigwizard.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index 471837bf..8225fe47 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -54,10 +54,11 @@ QGroupBox *createFieldBox(const QString &title, const std::vector &fi // provide specialized config widgets for those (which may be a good idea anyway, e.g. if we // think about client-side translations...) - QGroupBox *fieldBox = new QGroupBox; + auto *fieldBox = new QGroupBox; fieldBox->setTitle(title); + auto *formLayout = new QFormLayout; + fieldBox->setLayout(formLayout); - QFormLayout *formLayout = new QFormLayout(fieldBox); for (auto &&fieldInfo : fieldInfos) { QWidget *widget {nullptr}; switch (std::get<2>(fieldInfo).type()) { -- 2.20.1