Made the wxListBox::GetSelection method more efficient

This commit is contained in:
Liam Treacy
2019-01-21 16:16:17 +00:00
parent d8d7f673b2
commit a2356fbe4a

View File

@@ -207,15 +207,10 @@ int wxListBox::GetSelection() const
return wxNOT_FOUND; return wxNOT_FOUND;
} }
for ( unsigned int i = 0; i < GetCount(); ++i)
{
if( m_qtListWidget->item(i) == m_qtListWidget->selectedItems().first() )
{
return i;
}
}
return wxNOT_FOUND; QListWidgetItem* item = m_qtListWidget->selectedItems().first();
return m_qtListWidget->row(item);
} }
void wxListBox::DoSetFirstItem(int WXUNUSED(n)) void wxListBox::DoSetFirstItem(int WXUNUSED(n))