PDA

View Full Version : Problem in creating a QFileSystemModel



kamlmish
13th December 2010, 03:48
Hi All

I am creating an application where on a button click , the "browse to directory" window pops up
I have created the application , but when I initialise the QFileSystemModel, I get error
The code has been given below where the SLOT(FileBrowseWindow()) should be called when we click the browse_button
BUt currently , I am unable to initialise
m_Model = new QFileSystemModel(this); Line 11
while debugging the code goes in QGRAYRASTER.C




window::window()
{
setAcceptDrops(false);
namelabel = new QLabel("Name",this);
nametext = new QTextEdit(this);
loclabel = new QLabel("Location",this);
locText = new QTextEdit(this);
browse_button = new QPushButton("Browse",this);
ok_button = new QPushButton("Ok",this);
cancel_button = new QPushButton("Cancel",this);
m_Model = new QFileSystemModel(this);

//creation of menu
createMenu();




//connection: signal & slots
connect(browse_button,SIGNAL(clicked()),this,SLOT( FileBrowseWindow()),Qt::AutoConnection);
connect(cancel_button,SIGNAL(clicked()),this,SLOT( ClearButton()),Qt::AutoConnection);

}




void window::FileBrowseWindow()
{

QTreeView tree;
tree.setModel(m_Model);
m_Model->setRootPath(QString("/home/kamlesh/"));
tree.resize(640,480);
tree.show();
}

hackerNovitiate
16th December 2010, 15:03
while debugging the code goes in QGRAYRASTER.CCan you provide the exact message? That will make it easier to identify the problem.