Results 1 to 5 of 5

Thread: I beg your assistance: QListView does not work

  1. #1
    Join Date
    Oct 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default I beg your assistance: QListView does not work

    So: I have a model, which is a subclass of QAbstractListModel. It implements rowCount() and data(), both of which work fine. Alas, when I try to use this model to feed a QListView, however, nothing shows up.

    The QListView is empty.

    Naturally, this is extremely perplexing, and I am feeling quite frustrated. Any thoughts on the matter, please?

    Thank you very, very much in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I beg your assistance: QListView does not work

    Are these the only methods you have implemented?

    You can try this: http://labs.trolltech.com/page/Proje...view/Modeltest

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: I beg your assistance: QListView does not work

    Do you create the model with keyword "new"?
    J-P Nurmi

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I beg your assistance: QListView does not work

    Quote Originally Posted by jpn View Post
    Do you create the model with keyword "new"?
    Good question!

  5. #5
    Join Date
    Oct 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: I beg your assistance: QListView does not work

    Oops! I'm an idiot. I didn't have data() returning a new QVariant() for all other roles besides DataRole, because I didn't think they mattered. But they do!

    I am enlightened now. Thank you for the assistance anyhow, folks.

Similar Threads

  1. QListView word wrap
    By serega in forum Qt Programming
    Replies: 17
    Last Post: 30th August 2007, 03:13
  2. [QT3] QListView and Key_Delete - doesn't work?
    By InZone in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2006, 14:49

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.