[Solved]Extracting data to display in QListView
-
I want to make my QListView bind to my QSqlQueryModel. So far the below code works but will only display the first column data of each row(I believe, or it is counting each row that exist as 1,2,3...). How can I make it so I can display say column 2 that holds a column name reference (ie: The 2,3,4 columns that will produce "Marry Joe Smith").
@void ListUI::addItem(QSqlQueryModel *model){
theList->setModel(model);
}@Output:
1
2
3
4 -
Maybe to simple to say, but a list is a table with only 1 column if you ask me. If you want your model and view to have multiple columns you could use the QTableView.
Or am I missing a part of the problem? -
I think you want this:
@theList->setModelColumn(1);@Indexing of columns starts from 0
-
@qxoz thank you. I had not seen that member.