class Data: public QObject{ Q_OBJECT Q_PROPERTY(...) public: Data() {} ~Data() { qDebug() << "~Data"; }....};
ListView{ id: idTableBody anchors { fill: parent } clip: true model: M_Data}
for(int i = 0; i < lstData.count(); ++i) { auto *data= dynamic_cast<Data*>(lstData[i]); if(data) { if(data->getNumber() == delNumberData) { lstData.removeAt(i); delNumberReason = -1; return true; } } }
for(int i = 0; i < lstData.count(); ++i) { auto *data= dynamic_cast<Data*>(lstData[i]); if(data) { if(data->getNumber() == delNumber) { lstData[i]->deleteLater(); lstData.removeAt(i); delNumber = -1; context->setContextProperty("M_Data", QVariant::fromValue(lstData)); return true; } } }
context->setContextProperty("M_Data", QVariant::fromValue(QList<QObject*>()));qDeleteAll(lstData);lstData.clear();