Results 1 to 4 of 4

Thread: how to get all the entries inside a QList view

  1. #1
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default how to get all the entries inside a QList view

    Hi all,
    I have a QList View...
    Is there any function which return QStringList, which is list of all the entries inside the QListView?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to get all the entries inside a QList view

    The data is in the model, not the view. If you are using a QStringList model the QStringList::stringList() is the obvious place to go. If you are using a different model type then you need to iterate over the rows of the model extract the display text from the column that is being shown in the QListView.

  3. #3
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to get all the entries inside a QList view

    Now i have a QFileSystemModel and using QListView to display that model....
    If i want to get all those list which is dispalyed, what i need to do? which function i should use?

  4. #4
    Join Date
    Dec 2010
    Location
    Russia
    Posts
    83
    Thanks
    1
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to get all the entries inside a QList view

    In general , model's items do not necessarily have to store QStrings.However , if you do have QString's you may use :

    QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const : to get an idex of a desired item.

    and

    QAbstractItemModel ::QVariant data ( const QModelIndex & index, int role = Qt:: DisplayRole ) const : to get the data you need.

Similar Threads

  1. How to view data stored in Qmap or QList
    By sankar in forum Newbie
    Replies: 6
    Last Post: 17th February 2011, 10:30
  2. Replies: 0
    Last Post: 16th April 2010, 12:16
  3. QList inside a QList
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 1st July 2009, 12:59
  4. QGLWidget inside QGraphicsScene/View
    By h123 in forum Qt Programming
    Replies: 3
    Last Post: 10th January 2009, 09:46
  5. Links inside view
    By naresh in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2006, 15: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.