Merge pull request #578 from ToMoree/add_init_checked_for_treeview

fix treeview初始化时,设置checked为true无效
This commit is contained in:
zhuzichu 2024-12-24 21:51:40 +08:00 committed by GitHub
commit 1beb900455
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
#include "FluTreeModel.h" #include "FluTreeModel.h"
#include <QMetaEnum> #include <QMetaEnum>
@ -126,6 +126,7 @@ void FluTreeModel::setDataSource(QList<QMap<QString, QVariant>> data) {
node->_parent = _root; node->_parent = _root;
_root->_children.append(node); _root->_children.append(node);
} }
node->_checked = item.value("checked").toBool();
_dataSource.append(node); _dataSource.append(node);
if (item.contains("children")) { if (item.contains("children")) {
QList<QVariant> children = item.value("children").toList(); QList<QVariant> children = item.value("children").toList();