From 7a31bd12af859b44ad40315aafa791a1c2eab3f6 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Thu, 4 May 2023 19:59:37 +0200 Subject: [PATCH] qt/util.c: clearLayout, support QFormLayout (#28105) --- selfdrive/ui/qt/util.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/util.cc b/selfdrive/ui/qt/util.cc index 2e222f5956..c844cb2ba0 100644 --- a/selfdrive/ui/qt/util.cc +++ b/selfdrive/ui/qt/util.cc @@ -59,7 +59,8 @@ void configFont(QPainter &p, const QString &family, int size, const QString &sty } void clearLayout(QLayout* layout) { - while (QLayoutItem* item = layout->takeAt(0)) { + while (layout->count() > 0) { + QLayoutItem* item = layout->takeAt(0); if (QWidget* widget = item->widget()) { widget->deleteLater(); }