How to replace model method to QListWidget method?



  • hi,
    I am using model method from QAbstractItemModel to delete a rows from the QListWidget object,
    please suggest an alternate method to delete rows using QListWidget class.

               for(int i=ui->image_listWidget->model()->rowCount()-1;i>=0;--i){
               if(ui->image_listWidget->model()->index(i,0).data(Qt::CheckStateRole).toInt()==Qt::Checked)
               ui->image_listWidget->model()->removeRow(i);
    

    with this method i can delete the multiple rows.


  • Lifetime Qt Champion

    Hi,

    Do you mean like QAbstractItemModel::removeRows ?

    Note that you are checking for some condition to remove rows so there's no method to which you pass a list of index to get them removed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.