Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved How to replace model method to QListWidget method?

    Mobile and Embedded
    2
    2
    325
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kishore_hemmady last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • First post
          Last post