Quote Originally Posted by .:saeed:. View Post
but the output of setData in the following code is false:
Qt Code:
  1. ui->tblv_table->model()->setData( ui->tblv_table->model()->index(row, col, QModelIndex() ),
  2. QIcon("icon.png"), Qt::DecorationRole);
To copy to clipboard, switch view to plain text mode 
tblv_table is a QTableView
It is false because the underlying generic SQL database has nowhere to store the image that you have set as the Decoration role. You can either use a delegate on the view to draw the relevant icon or you could subclass QSqlTableModel and override data() to return appropriate icons when the DisplayRole is requested by the view (and pass other requests on to the base class).