Reuse code between wxListBox::Create() overloads
Add DoCreate() helper to actually create and initialize QListWidget.
This commit is contained in:
parent
a2356fbe4a
commit
c8f427181e
@ -90,7 +90,9 @@ protected:
|
||||
private:
|
||||
virtual void Init(); //common construction
|
||||
|
||||
void setStyle(long style);
|
||||
// Common part of both Create() overloads.
|
||||
void DoCreate(wxWindow* parent, long style);
|
||||
|
||||
void UnSelectAll();
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxListBox);
|
||||
|
@ -86,11 +86,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
Init();
|
||||
QListWidgetItem* item;
|
||||
m_qtWindow = m_qtListWidget = new wxQtListWidget( parent, this );
|
||||
DoCreate(parent, style);
|
||||
|
||||
setStyle(style);
|
||||
QListWidgetItem* item;
|
||||
|
||||
while ( n-- > 0 )
|
||||
{
|
||||
@ -114,10 +112,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
Init();
|
||||
m_qtWindow = m_qtListWidget = new wxQtListWidget( parent, this );
|
||||
|
||||
setStyle(style);
|
||||
DoCreate(parent, style);
|
||||
|
||||
QStringList items;
|
||||
|
||||
@ -129,8 +124,13 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
return wxListBoxBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
void wxListBox::setStyle(long style)
|
||||
void wxListBox::DoCreate(wxWindow* parent, long style)
|
||||
{
|
||||
Init();
|
||||
|
||||
m_qtWindow =
|
||||
m_qtListWidget = new wxQtListWidget( parent, this );
|
||||
|
||||
if ( style & wxLB_SORT )
|
||||
{
|
||||
m_qtListWidget->setSortingEnabled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user