Hi all, I have a QListWidget and I have connected a button "clicked" signal to a slot where I need to select all the items in the list. This is the code that I use:
void MyPage::selectAll()
{
int n = list -> count();
if ((list -> selectedItems()).count() == n) return;
for (int i = 0; i < n; i++)
list -> setItemSelected(list -> item(i), true);
}
void MyPage::selectAll()
{
int n = list -> count();
if ((list -> selectedItems()).count() == n) return;
for (int i = 0; i < n; i++)
list -> setItemSelected(list -> item(i), true);
}
To copy to clipboard, switch view to plain text mode
I want to know if there's some other way to do this more eficiently, without having to go through all the items in the list, using QListWidget::selectedItems() maybe?
Thanks.
Bookmarks