How to Customize the treeView?
-
I want to make the QTreeView show the data without files
So I inherit QTreeView and override "isIndexHidden"
But the customTreeView still show the files[code]
class customTreeView : public QTreeView
{
protected:
bool isIndexHidden( const QModelIndex &index ) const
{
QDirModel dirModel = static_cast<QDirModel>(model());
qDebug() << dirModel->fileName(index);
if(dirModel->fileInfo(index).isFile())
return true;return false; }
};
inline int customTableViewTest(QApplication &app)
{
QDirModel model;QTreeView view; view.setModel(&model); customTreeView cView; cView.setModel(&model); QSplitter splitter; splitter.addWidget(&view); splitter.addWidget(&cView); splitter.show(); return app.exec();
}
[/code]How could I fix it?Thanks
-
check this "post":http://qt-project.org/forums/viewthread/19522/
However both the posts are same.
-
Closing post as duplicate.