Using a QStyledItemDelegate on a QListView with QSqlQueryModel
问题 I have a QListView, that has a QSqlQueryModel set as its model. How can I use a QStyledItemDelegate in order to customise the QListView's rows' appearence (e.g. show 2 text lines) ? QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE" ); db.setDatabaseName( "test.db" ); if( !db.open() ) { qDebug() << db.lastError(); qFatal( "Failed to connect." ); } qDebug( "Connected!" ); QSqlQueryModel *sqlModel = new QSqlQueryModel; sqlModel->setQuery("SELECT * FROM entries"); mListWidget->setModel