Updated the GetSelections method to use QListWidget method to retrieve selected items rather than iterating through the list. Also updated the UnSelectAll method to be more efficient

This commit is contained in:
Liam Treacy
2019-01-21 16:00:03 +00:00
parent ffcda97d04
commit ab3c460a93

View File

@@ -167,10 +167,9 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
aSelections.clear();
for ( unsigned int i = 0; i < GetCount(); ++i)
Q_FOREACH(QListWidgetItem* l, m_qtListWidget->selectedItems())
{
if ( IsSelected(i) )
aSelections.push_back(i);
aSelections.push_back( m_qtListWidget->row(l) );
}
return aSelections.size();
@@ -299,9 +298,8 @@ QScrollArea *wxListBox::QtGetScrollBarsContainer() const
void wxListBox::UnSelectAll()
{
for ( unsigned int i = 0; i < GetCount(); ++i )
Q_FOREACH(QListWidgetItem* l, m_qtListWidget->selectedItems())
{
if ( IsSelected(i) )
DoSetSelection(i, false);
m_qtListWidget->setItemSelected( l, false );
}
}