Honour wxCB_READONLY flag in wxQt wxComboBox

Don't make the combobox unconditionally editable, but only do this if
wxCB_READONLY is not specified.

Closes https://github.com/wxWidgets/wxWidgets/pull/1207
This commit is contained in:
Tristan
2019-01-31 10:45:06 +00:00
committed by Vadim Zeitlin
parent 6370662cc8
commit 7de612dd92

View File

@@ -55,7 +55,6 @@ wxQtComboBox::wxQtComboBox( wxWindow *parent, wxComboBox *handler )
: wxQtEventSignalHandler< QComboBox, wxComboBox >( parent, handler ), : wxQtEventSignalHandler< QComboBox, wxComboBox >( parent, handler ),
m_textChangeIgnored( false ) m_textChangeIgnored( false )
{ {
setEditable( true );
connect(this, static_cast<void (QComboBox::*)(int index)>(&QComboBox::activated), connect(this, static_cast<void (QComboBox::*)(int index)>(&QComboBox::activated),
this, &wxQtComboBox::activated); this, &wxQtComboBox::activated);
connect(this, &QComboBox::editTextChanged, connect(this, &QComboBox::editTextChanged,
@@ -160,6 +159,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& name ) const wxString& name )
{ {
m_qtComboBox = new wxQtComboBox( parent, this ); m_qtComboBox = new wxQtComboBox( parent, this );
m_qtComboBox->setEditable(!(style & wxCB_READONLY));
QtInitSort( m_qtComboBox ); QtInitSort( m_qtComboBox );
while ( n-- > 0 ) while ( n-- > 0 )