From Your posts I can only assume that You are lacking in understanding what MVC (Model View Controller) is.
Basically QListView is a View for the model. QListView don't store Your data, it's only a way to display it to the user in list manner. (thats why this class name is *View, QTableView will display Your data in table manner, QComboBox will add combobox). The data is stored in the so called model, and simply saying it is independent (from the View) way of storing Your information/data. Idea behind this is that You can represent the same model in different way (depending on the View/Delegates).
Examples:
QListView:
Snap1..jpgSnap2..jpg
QTableView:
Snap3..jpg
QComboBox:
Snap4..jpg
Ass You can see I used the same model to display my "Data" in different way's. (depending on the needs)
QListWidget is different then QListView, because it actually store that data that You want to display. For Your needs probably QListWidget is simplest way to go.
Place QListWidget on the main form and use this code to add entries to the QListWidget:
if( !path.isEmpty())
{
ui->listWidget->addItems( path );
}
QStringList path = QFileDialog::getOpenFileNames(this, tr("Files"), QDir::currentPath(), tr("*.jpg *.png *.gif *.bmp"));
if( !path.isEmpty())
{
ui->listWidget->addItems( path );
}
To copy to clipboard, switch view to plain text mode
This is the simplest way to add items to the QListWidget.
For the rest, You need to study MVC, or look as was pointed out earlier, into qt docs.
Bookmarks