Results 1 to 3 of 3

Thread: Crash due to usage of QModelIndex inside QFileDialog?

  1. #1
    Join Date
    Nov 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Crash due to usage of QModelIndex inside QFileDialog?

    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.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 162 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Crash due to usage of QModelIndex inside QFileDialog?

    * 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

  3. #3
    Join Date
    Nov 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Crash due to usage of QModelIndex inside QFileDialog?

    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.
    Last edited by mails.hemant; 24th November 2008 at 09:25. Reason: reformatted to look better

Similar Threads

  1. QSql*Model + QTreeView : make a tree
    By punkypogo in forum Qt Programming
    Replies: 18
    Last Post: 24th October 2008, 18:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.