ui/networking: remove call to clearLayout (#29037)

* build list inplace

* move clearLayout to cabana

* cleanup include

* polish style

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
Dean Lee
2023-08-14 02:57:40 +08:00
committed by GitHub
parent 3a00149f56
commit fd8a9c8520
5 changed files with 111 additions and 87 deletions
+14
View File
@@ -7,6 +7,20 @@
#include "selfdrive/ui/qt/util.h"
// TODO: remove clearLayout
static void clearLayout(QLayout* layout) {
while (layout->count() > 0) {
QLayoutItem* item = layout->takeAt(0);
if (QWidget* widget = item->widget()) {
widget->deleteLater();
}
if (QLayout* childLayout = item->layout()) {
clearLayout(childLayout);
}
delete item;
}
}
PandaStream::PandaStream(QObject *parent, PandaStreamConfig config_) : config(config_), LiveStream(parent) {
if (config.serial.isEmpty()) {
auto serials = Panda::list();