QFileSystemModel的data(const QModelIndex &index, int role)方法何时,被谁调用?

ashy1q 2013-05-06 10:53:34
将QFileSystemModel绑定QListView,然后当点击一个目录显示文件时,data()方法会被频繁调用好多次(4次左右,将一个目录下所有的文件名打印4次——log中显示),但是却找不到这个方法被谁调用。

在QListView的父类方法QAbstractItemViewPrivate::checkMouseMove()中找到一次调用,但也只找到这一处调用,其它还有什么地方调用呢

请指导 谢谢~~

void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) {
//we take a persistent model index because the model might change by emitting signals
Q_Q(QAbstractItemView);
setHoverIndex(index);
if (viewportEnteredNeeded || enteredIndex != index) {
viewportEnteredNeeded = false;

if (index.isValid()) {
emit q->entered(index);
#ifndef QT_NO_STATUSTIP
QString statustip = model->data(index, Qt::StatusTipRole).toString();
......
}
...全文
66 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

16,235

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧