PDA

View Full Version : Crash due to usage of QModelIndex inside QFileDialog?



mails.hemant
13th November 2008, 15:47
Hi everyone,

I am new in the wonderful world of Qt. I have a problem regarding using the QModelIndex inside the QFileDialog class.

I have implemented a doubleClicked(const QModelIndex&) signal which calles a slot treeitemclicked(QModelIndex const&) whenever i double click on any row item from the treeview.

The Syntax is as like below:

connect(view->treeItemView(), SIGNAL(doubleClicked(const QModelIndex&)),this, SLOT (treeitemclicked(QModelIndex const&)));

Inside the slot definition, i got the modelindex with correct row, column values along with parent pointer. But i am not sure that my this parent pointer is correct or not.
also if i check the validity of my modelindex through isvalid function, it comes true( correct).

I don't know what is going wrong on my side. Can anyone please suggest me some solution of this problem.

caduel
13th November 2008, 15:54
* make sure that you use the QModelIndex with the correct model (idx.model() == your_model)
* give us some code so we have a chance to help you

mails.hemant
24th November 2008, 09:23
Hi,

Thanks in advance

I have a seperate cpp file for model item data and when i am using it inside this filedialog class, i am initializing it with model's class constructor and one thing more that with this model object i am accesing an another function of the same model class which is working fine.

The only difference between these two callings was that in the working function there is no argument of QModelIndex type.