Added setStyle method to wxListBox to allow for the proper setting of sorting and selection style of the QListWidget
This commit is contained in:
@@ -90,6 +90,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
virtual void Init(); //common construction
|
virtual void Init(); //common construction
|
||||||
|
|
||||||
|
void setStyle(long style);
|
||||||
void UnSelectAll();
|
void UnSelectAll();
|
||||||
|
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxListBox);
|
wxDECLARE_DYNAMIC_CLASS(wxListBox);
|
||||||
|
@@ -90,10 +90,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
QListWidgetItem* item;
|
QListWidgetItem* item;
|
||||||
m_qtWindow = m_qtListWidget = new wxQtListWidget( parent, this );
|
m_qtWindow = m_qtListWidget = new wxQtListWidget( parent, this );
|
||||||
|
|
||||||
if ( style == wxLB_SORT )
|
setStyle(style);
|
||||||
{
|
|
||||||
m_qtListWidget->setSortingEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( n-- > 0 )
|
while ( n-- > 0 )
|
||||||
{
|
{
|
||||||
@@ -120,6 +117,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
Init();
|
Init();
|
||||||
m_qtWindow = m_qtListWidget = new wxQtListWidget( parent, this );
|
m_qtWindow = m_qtListWidget = new wxQtListWidget( parent, this );
|
||||||
|
|
||||||
|
setStyle(style);
|
||||||
|
|
||||||
QStringList items;
|
QStringList items;
|
||||||
|
|
||||||
for (size_t i = 0; i < choices.size(); ++i)
|
for (size_t i = 0; i < choices.size(); ++i)
|
||||||
@@ -130,6 +129,27 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return wxListBoxBase::Create( parent, id, pos, size, style, validator, name );
|
return wxListBoxBase::Create( parent, id, pos, size, style, validator, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxListBox::setStyle(long style)
|
||||||
|
{
|
||||||
|
if ( style & wxLB_SORT )
|
||||||
|
{
|
||||||
|
m_qtListWidget->setSortingEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( style & wxLB_SINGLE )
|
||||||
|
{
|
||||||
|
m_qtListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
}
|
||||||
|
else if ( style & wxLB_MULTIPLE )
|
||||||
|
{
|
||||||
|
m_qtListWidget->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||||
|
}
|
||||||
|
else if ( style & wxLB_EXTENDED )
|
||||||
|
{
|
||||||
|
wxMISSING_IMPLEMENTATION( wxSTRINGIZE( wxLB_EXTENDED ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxListBox::Init()
|
void wxListBox::Init()
|
||||||
{
|
{
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
|
Reference in New Issue
Block a user