It is simple to construct a tree view displaying data from a model. In the following example, the contents of a directory are supplied by a QFileSystemModel and displayed as a tree:
QFileSystemModel *model = new QFileSystemModel
model->setRootPath(QDir::currentPath())
QTreeView *tree = new QTreeView(splitter)
tree->睁搜档setModel(model)
如果要使用QTreeWidget 就要使用QFileInfo对文件夹进行悉乱遍历,挨个添加到QTreeWidget中。有关QFileInfo请参考帮助漏毁文档:http://qt-project.org/doc/qt-4.8/qfileinfo.html
String[] s={"January", "燃雀闹February"岁型, "March", "April"皮罩, "May", "June", "July", "August", "September", "October", "November", "December"}System.out.print("请输入数字(1-12):")
BufferedReader br=new BufferedReader(new InputStreamReader(System.in))
String str=br.readLine()
int m=Integer.parseInt(str)
if (m<=0||m>=13)
{
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)