Results 1 to 5 of 5

Thread: Adding elements to a QListView

  1. #1

    Default Adding elements to a QListView

    Hi, everyone, yet another newbie asking about Qt here. First post, by the way, so nice to meet you all.

    I'm trying to make a scrollable list of images, and the best option so far seems to be using a QListView in IconMode. However, no matter how hard I search, I can't find a way to add items to that view. All the examples I've found so far are for Qt version 3.3 and use QListViewItems, which (apparently) no longer exist in Qt 4.5. Since I'm starting, I'm focusing on Qt 4.5: I don't want to get mixed up from the beginning.

    Anybody knows how to add elements (specifically images) to a QListView in Qt 4.5? Should I drop the QListView altogether and go for some other option? Thanks in advance for any suggestions.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Adding elements to a QListView

    you have to use delegates in listview.. read about model/view

  3. #3

    Default Re: Adding elements to a QListView

    Ehm... thanks for the reply, but, as I said, newbie. Care to share a link, or explain what "model/view" is?

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Adding elements to a QListView

    have a look at this and also have a look at Qt's examples QTDIR\examples\itemviews.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5

    Default Re: Adding elements to a QListView

    Thanks! I think I now understand how this works. On to put it to practice!

Similar Threads

  1. how to move item up and down in QListView
    By zhanglr in forum Qt Programming
    Replies: 3
    Last Post: 1st August 2008, 14:39
  2. QListView word wrap
    By serega in forum Qt Programming
    Replies: 17
    Last Post: 30th August 2007, 03:13
  3. QDialog / QListView problem
    By harakiri in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2007, 18:31
  4. Subclass QListView to show two colums in one
    By Mookie in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2007, 02:12
  5. Keeping focus at bottom of QListView
    By jakamph in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2006, 14:45

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.