mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-04-02 04:38:37 +08:00
修复FluTreeModel::setDataSource内存泄漏问题
This commit is contained in:
parent
882cc8989f
commit
2cc17e9db3
@ -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;
|
||||
|
@ -474,6 +474,7 @@ Rectangle {
|
||||
}
|
||||
return {}
|
||||
}
|
||||
active: rowModel !== undefined && rowModel !== null
|
||||
sourceComponent: {
|
||||
if(column === 0)
|
||||
return com_column
|
||||
|
@ -474,6 +474,7 @@ Rectangle {
|
||||
}
|
||||
return {}
|
||||
}
|
||||
active: rowModel !== undefined && rowModel !== null
|
||||
sourceComponent: {
|
||||
if(column === 0)
|
||||
return com_column
|
||||
|
Loading…
x
Reference in New Issue
Block a user