ChMaster
12th April 2006, 23:11
hi guys,
i have a littel problem with QDirModel.
QString workspace = QFileDialog::getExistingDirectory( this, tr("Open worspace"), QDir::homePath() );
if ( workspace.isEmpty() )
return;
QDirModel *model = new QDirModel();
model->setFilter( QDir::AllDirs );
model->setLazyChildCount( true );
model->setData( model->index( workspace ), QVariant(workspace), Qt::DisplayRole );
model->setHeaderData(0, Qt::Horizontal, workspace);
tvWorkspace->setModel( model );
tvWorkspace->setRootIndex( model->index( workspace ) );
tvWorkspace->header()->setSortIndicatorShown( true );
tvWorkspace->header()->setClickable( true );
tvWorkspace->setColumnHidden( 1, true );
tvWorkspace->setColumnHidden( 2, true );
tvWorkspace->setColumnHidden( 3, true );
connect( tvWorkspace, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( workspaceItemChanged( const QModelIndex & ) ) );
it is work but i see only the folders in this QTreeView:
|-include
|-src
|-ui
but i would like this:
/home/alex/project/test
|-include
|-src
|-ui
i searched on forum index, but can not found items of this ....
but how? can anyone help me? .....
i have a littel problem with QDirModel.
QString workspace = QFileDialog::getExistingDirectory( this, tr("Open worspace"), QDir::homePath() );
if ( workspace.isEmpty() )
return;
QDirModel *model = new QDirModel();
model->setFilter( QDir::AllDirs );
model->setLazyChildCount( true );
model->setData( model->index( workspace ), QVariant(workspace), Qt::DisplayRole );
model->setHeaderData(0, Qt::Horizontal, workspace);
tvWorkspace->setModel( model );
tvWorkspace->setRootIndex( model->index( workspace ) );
tvWorkspace->header()->setSortIndicatorShown( true );
tvWorkspace->header()->setClickable( true );
tvWorkspace->setColumnHidden( 1, true );
tvWorkspace->setColumnHidden( 2, true );
tvWorkspace->setColumnHidden( 3, true );
connect( tvWorkspace, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( workspaceItemChanged( const QModelIndex & ) ) );
it is work but i see only the folders in this QTreeView:
|-include
|-src
|-ui
but i would like this:
/home/alex/project/test
|-include
|-src
|-ui
i searched on forum index, but can not found items of this ....
but how? can anyone help me? .....