Results 1 to 3 of 3

Thread: Delegate not passing the correct index for the model

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Maemo/MeeGo

    Default Delegate not passing the correct index for the model

    I have a some code like follows, when i click on a list item in the view, there is a runtime error with model[index], i cant figure out why, in qt creator index is also highlighted blue & italicized like javascript:

    somemodelpage.qml

    Qt Code:
    1. page{
    2. listview {
    3. id: itemview
    4. delegate: itemdelegate { }
    5. model: cppmodel
    6.  
    7. function delegateClicked(index) {
    8. model.folder = model[index].name;
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

    itemdelegate.qml
    Qt Code:
    1. Item {
    2. id: root
    3. ...
    4. mousearea {
    5. onclicked: root.ListView.view.delegateClicked(index)
    6. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by balisingh; 26th October 2012 at 04:41.

Similar Threads

  1. Proxy model, index mapping.
    By wojtekw in forum Qt Programming
    Replies: 14
    Last Post: 7th January 2016, 08:09
  2. Mapping Index from View to Model
    By toodles in forum Newbie
    Replies: 1
    Last Post: 3rd July 2012, 19:37
  3. QFileSystemModel::remove not removing index from model
    By revorgm in forum Qt Programming
    Replies: 1
    Last Post: 27th February 2011, 09:24
  4. QDataWidgetMapper setting own model index
    By AlGaN in forum Qt Programming
    Replies: 0
    Last Post: 16th February 2010, 16:34
  5. How to get index of a combobox delegate selection
    By vieraci in forum Qt Programming
    Replies: 12
    Last Post: 21st July 2009, 16:37

Tags for this Thread

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.