⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

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){

    with this method i can delete the multiple rows.

  • Lifetime Qt Champion


    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