I installed the Nokia Qt SDK and made a new project which involved a user interface.
Then I referred to a particular video, Creating interactive QT hello world GUI application using QT Creator.
Now I am not able to ad开发者_StackOverflow社区d items in list view as there is no function to do that.
Is there some other function to do it?
To add rows:
ui->listview->model()->insertRow ( int row)
or
ui->listview->model()->insertRows ( int row, int count)
Both methods return true if the rows were successfully inserted.
To set data (for each cell):
ui->listview->model()->setData(ui->listview->model()->index ( int row, int column),QVariant value);
What do you mean by "There is no function to do that" ?
Have you already looked into the Qt Documentation? There is also a QListWidget where you can directly add widgets. More useful is the QListView you mentioned, for which you should have a look at Qt Model/View Programming first.
精彩评论