Ich weiß nicht genau wie ich Objekte ordentlich löschen und neu hinzufügen kann. Vor allem wo und wie ich deletes setzen muss.
Das folgende funktioniert nur mies. Also das Adden klappt. Aber das clearen scheint nie richtig zu funktionieren.
Es geht um folgendes:
Code: Alles auswählen
void FDSA :: addSubPlotable() {
QGroupBox* group = new QGroupBox("Titel");
QHBoxLayout* layout = new QHBoxLayout();
QLabel* label = new QLabel("");
layout->addWidget(label);
group->setLayout(layout);
ui->vLayoutPlotables->addWidget(group);
m_SubPlotableCount += 1;
}
void FDSA :: clearGUI() {
_u16 count = ui->vLayoutPlotables->count();
for(_u16 i = 0; i < count; i++) {
QLayoutItem* item = ui->vLayoutPlotables->itemAt(i);
ui->vLayoutPlotables->removeItem(item);
}
}Die ist Anzahl variabel und wird zur Laufzeit festgestellt und sie ändert sich auch zur Laufzeit.
Mag mir jemand sagen wie man das regelt?