firemail
标题:
QTreeView 数据过滤,使用代理model
[打印本页]
作者:
Qter
时间:
2020-3-13 11:41
标题:
QTreeView 数据过滤,使用代理model
自定义实现代理QSortFilterProxyModel注意在相关函数调用中进行mapToSource的index转换
bool MySortFilterProxyModel::setExtDataExpanded(const QModelIndex& index, bool value)
{
QModelIndex sourceIndex = QSortFilterProxyModel::mapToSource(index);
//qDebug() << "MySortFilterProxyModel::setExtDataExpanded" << index << value << sourceIndex;
return (dynamic_cast<TreeModel*>(sourceModel()))->setExtDataExpanded(sourceIndex, value);
}
作者:
Qter
时间:
2020-3-13 11:42
https://blog.csdn.net/dpsying/article/details/80383752
https://blog.csdn.net/dpsying/article/details/80384094
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3