Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to replace model method to QListWidget method?
Forum Updated to NodeBB v4.3 + New Features

How to replace model method to QListWidget method?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 419 Views 1 Watching
  • 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 Offline
    K Offline
    kishore_hemmady
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved