Thanks a lot Yogesh. Now I have this question related to Model-View architecture( I am totally new to it. )
How do I access the 'filePath' of this QDirModel from another function?
{
ui.setupUi( this );
//QFileSystemModel *model = new QFileSystemModel;
ui.tree->setModel(model);
connect(ui.
tree,
SIGNAL( doubleClicked
( const QModelIndex & )),
this,
SLOT(previewFile
( const QModelIndex & )));
}
void fileLoader
::previewFile( const QModelIndex & index
) {
//QString filePath = ui.tree ->filePath( index );
}
fileLoader::fileLoader( QWidget *parent ) : QDialog( parent )
{
ui.setupUi( this );
//QFileSystemModel *model = new QFileSystemModel;
QDirModel *model = new QDirModel;
ui.tree->setModel(model);
connect(ui.tree, SIGNAL( doubleClicked( const QModelIndex & )), this, SLOT(previewFile( const QModelIndex & )));
}
void fileLoader::previewFile( const QModelIndex & index )
{
//QString filePath = ui.tree ->filePath( index );
}
To copy to clipboard, switch view to plain text mode
I know that
QString filePath = ui.tree ->filePath( index );
is wrong. But how do I access that particular function? What is the right procedure to do it?
Bookmarks