Results 1 to 5 of 5

Thread: Something fishy about Model, data doesn't show up!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Prague
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Something fishy about Model, data doesn't show up!

    Hi,

    I cant implement columnCount, because I use QAbstractListModel, which has it already implemented.

    I addded debuging statement:
    Qt Code:
    1. public Object data(QModelIndex index, int role)
    2. {
    3. System.out.println(index);
    4. System.out.println(role);
    5. if (index.row() < 0 || index.row() >= dispeceri.size())
    6. return new Object();
    7.  
    8. if (role == Qt.ItemDataRole.DisplayRole)
    9. return ((SmenaDispecer) dispeceri.get(index.row())).getDlouheJmeno();
    10. else
    11. return new Object();
    12. }
    To copy to clipboard, switch view to plain text mode 

    and got following (running in ant):
    Qt Code:
    1. [java] QModelIndex(row=0,col=0,internal=0)
    2. [java] 13
    3. [java] QModelIndex(row=1,col=0,internal=0)
    4. [java] 13
    5. [java] QModelIndex(row=2,col=0,internal=0)
    6. [java] 13
    7. [java] QModelIndex(row=3,col=0,internal=0)
    8. [java] 13
    9. [java] QModelIndex(row=4,col=0,internal=0)
    10. [java] 13
    To copy to clipboard, switch view to plain text mode 

    Pretty weard is, that when I use QTableView instead of QListView, everything works fine!

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

    Default Re: Something fishy about Model, data doesn't show up!

    I am not experienced with Jambi.
    And the code does look ok to me.

    Try calling the base class instead of 'only' returning "new Object()".

Similar Threads

  1. Clearing data model
    By db in forum Newbie
    Replies: 6
    Last Post: 16th February 2008, 13:10
  2. Data model
    By steg90 in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2007, 12:14
  3. Custom Model Class
    By mattjgalloway in forum Qt Programming
    Replies: 12
    Last Post: 4th June 2007, 17:30
  4. Informing a model its data has changed
    By saknopper in forum Newbie
    Replies: 3
    Last Post: 17th January 2007, 19:58
  5. Model, view, resize to show all data
    By jcr in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2006, 20:59

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
  •  
Qt is a trademark of The Qt Company.