Jarikus
25th October 2010, 20:59
I use QTreeView + QDirModel, for view my catalog. My catalog have one file 'File1.txt'. But I need display second file ‘File2.txt’ in QTreeView but don’t create this file in my catalog!.
File2.txt have been to QDirModel and display in QTreeView but not create physically on my drive when be located my catalog i.e. I`am not use Filters.
MyCatalog
-- File1.txt - Realy file in my catalog
-- File2.txt - Only display file in QTreeView!
I create class with reimplemented method “insertRow()â€:
class DirModelMod : public QDirModel
{
public:
DirModelMod();
~DirModelMod();
private:
bool insertRow ( int row, const QModelIndex & parent = QModelIndex() );
};
But how I`am can add item (files) in insertRow()?
Please litle sample how add item in QDirModel in reimplement insertRow() or what I need using. And then for setData() I`am understand myself. Tnks.
PS I`am not insert ‘File2.txt’ in QTreeView because it created in QT Designer and file must view in other widgets.
PS Sr for my English ;)
File2.txt have been to QDirModel and display in QTreeView but not create physically on my drive when be located my catalog i.e. I`am not use Filters.
MyCatalog
-- File1.txt - Realy file in my catalog
-- File2.txt - Only display file in QTreeView!
I create class with reimplemented method “insertRow()â€:
class DirModelMod : public QDirModel
{
public:
DirModelMod();
~DirModelMod();
private:
bool insertRow ( int row, const QModelIndex & parent = QModelIndex() );
};
But how I`am can add item (files) in insertRow()?
Please litle sample how add item in QDirModel in reimplement insertRow() or what I need using. And then for setData() I`am understand myself. Tnks.
PS I`am not insert ‘File2.txt’ in QTreeView because it created in QT Designer and file must view in other widgets.
PS Sr for my English ;)