mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
UI: Add helper to delete layout and layout contents
This commit is contained in:
parent
6262abc2c8
commit
370761ba29
|
@ -18,6 +18,7 @@
|
|||
#include "qt-wrappers.hpp"
|
||||
#include <graphics/graphics.h>
|
||||
#include <QWidget>
|
||||
#include <QLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QDataStream>
|
||||
|
||||
|
@ -133,3 +134,25 @@ QDataStream &operator>>(QDataStream &in, OBSSceneItem &si)
|
|||
|
||||
return in;
|
||||
}
|
||||
|
||||
void DeleteLayout(QLayout *layout)
|
||||
{
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
for (;;) {
|
||||
QLayoutItem *item = layout->takeAt(0);
|
||||
if (!item)
|
||||
break;
|
||||
|
||||
QLayout *subLayout = item->layout();
|
||||
if (subLayout) {
|
||||
DeleteLayout(subLayout);
|
||||
} else {
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
delete layout;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
class QDataStream;
|
||||
class QWidget;
|
||||
class QLayout;
|
||||
struct gs_window;
|
||||
|
||||
void OBSErrorBox(QWidget *parent, const char *msg, ...);
|
||||
|
@ -60,3 +61,5 @@ public:
|
|||
widget->blockSignals(blocked);
|
||||
}
|
||||
};
|
||||
|
||||
void DeleteLayout(QLayout *layout);
|
||||
|
|
Loading…
Reference in a new issue