修复FluTreeModel::setDataSource内存泄漏问题

This commit is contained in:
Polaris-Night 2025-03-03 21:14:11 +08:00
parent 882cc8989f
commit 2cc17e9db3
3 changed files with 4 additions and 2 deletions

View File

@ -107,7 +107,7 @@ void FluTreeModel::checkRow(int row, bool checked) {
void FluTreeModel::setDataSource(QList<QMap<QString, QVariant>> data) {
_dataSource.clear();
if (_root) {
delete _root;
_root->deleteLater();
_root = nullptr;
}
_root = new FluTreeNode(this);
@ -115,7 +115,7 @@ void FluTreeModel::setDataSource(QList<QMap<QString, QVariant>> data) {
while (data.count() > 0) {
auto item = data.at(data.count() - 1);
data.pop_back();
auto *node = new FluTreeNode(this);
auto *node = new FluTreeNode(_root);
node->_depth = item.value("__depth").toInt();
node->_parent = item.value("__parent").value<FluTreeNode *>();
node->_data = item;

View File

@ -474,6 +474,7 @@ Rectangle {
}
return {}
}
active: rowModel !== undefined && rowModel !== null
sourceComponent: {
if(column === 0)
return com_column

View File

@ -474,6 +474,7 @@ Rectangle {
}
return {}
}
active: rowModel !== undefined && rowModel !== null
sourceComponent: {
if(column === 0)
return com_column