Hi all,
I have a QList View...
Is there any function which return QStringList, which is list of all the entries inside the QListView?
Hi all,
I have a QList View...
Is there any function which return QStringList, which is list of all the entries inside the QListView?
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.
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?
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.
Bookmarks