标签:style blog color io 使用 ar sp div on
QTreeView比较复杂,在这里记下所有用到的操作:
-----------------------------------------------------------------------------
如何给QTreeView的节点显示图标
要显示节点图标,就在重写模型的时候在DecorationRole角色时返回要显示的图标就可以了
Node *node = nodeFromIndex(index); if (role == Qt::DecorationRole){ switch(node->item){ case Node:: Root: return QIcon(":/images/ras.ico"); case Node::Downloading: return QIcon(":/images/Download.png"); case Node::Downloaded: return QIcon(":/images/Misc-Stuff.png"); case Node::Daily: return QIcon(":/images/Database.png"); case Node::Timespace: return QIcon(":/images/Software.ico"); } }
标签:style blog color io 使用 ar sp div on
原文地址:http://www.cnblogs.com/findumars/p/4013472.html