Deselect all items in wxQt wxListBox::SetSelection(wxNOT_FOUND)
Follow wxWidgets API convention in wxQt too.
This commit is contained in:
committed by
Vadim Zeitlin
parent
1f0e456620
commit
10381cb94e
@@ -90,6 +90,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
virtual void Init(); //common construction
|
virtual void Init(); //common construction
|
||||||
|
|
||||||
|
void UnSelectAll();
|
||||||
|
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxListBox);
|
wxDECLARE_DYNAMIC_CLASS(wxListBox);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -182,6 +182,12 @@ void wxListBox::DoSetFirstItem(int WXUNUSED(n))
|
|||||||
|
|
||||||
void wxListBox::DoSetSelection(int n, bool select)
|
void wxListBox::DoSetSelection(int n, bool select)
|
||||||
{
|
{
|
||||||
|
if ( n == wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
UnSelectAll();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return m_qtListWidget->setCurrentRow(n, select ? QItemSelectionModel::Select : QItemSelectionModel::Deselect );
|
return m_qtListWidget->setCurrentRow(n, select ? QItemSelectionModel::Select : QItemSelectionModel::Deselect );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,3 +254,12 @@ QScrollArea *wxListBox::QtGetScrollBarsContainer() const
|
|||||||
{
|
{
|
||||||
return (QScrollArea *) m_qtListWidget;
|
return (QScrollArea *) m_qtListWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxListBox::UnSelectAll()
|
||||||
|
{
|
||||||
|
for ( unsigned int i = 0; i < GetCount(); ++i )
|
||||||
|
{
|
||||||
|
if ( IsSelected(i) )
|
||||||
|
DoSetSelection(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user