C++-Qt【4】-CheckBox on QListView
引用:http://www.qtcentre.org/threads/47119-checkbox-on-QListView
QListWidgetItem *item = new QListWidgetItem; item->setData( Qt::DisplayRole, "text" ); item->setData( Qt::CheckStateRole, Qt::Checked ); listWidget->addItem( item );
QStandardItemModel *model = new QStandardItemModel(); QStandardItem *Item = new QStandardItem(); Item->setCheckable( true ); Item->setCheckState( Qt::Checked ); model->setItem( 0, Item ); listView->setModel( model );