int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QFileSystemModel model;
QTreeView tree;
tree.setModel(&model);
// Demonstrating look and feel features
tree.setAnimated(false);
tree.setIndentation(20);
tree.setSortingEnabled(true);
tree.setWindowTitle(QObject::tr("Dir View"));
tree.resize(640, 480);
tree.show();
return app.exec();
}
此例子显示:,我怎么控制其只显示Name列. 不显示其它列信息/ 谢谢了
Qt
------解决方案--------------------
自己定义一个QFileSystemModel的子类,在
QVariant QFileSystemModel::data ( const QModelIndex & index, int role = Qt::DisplayRole ) const [virtual]修改你想修改的列