Merge branch 'qt_combobox_crash' of https://github.com/GeoTeric/wxWidgets

Fix crashes when using wxCB_READONLY in wxQt.

See https://github.com/wxWidgets/wxWidgets/pull/1221
This commit is contained in:
Vadim Zeitlin
2019-02-05 03:04:21 +01:00
2 changed files with 13 additions and 3 deletions

View File

@@ -87,6 +87,7 @@ protected:
private:
void SetActualValue(const wxString& value);
bool IsReadOnly() const;
// From wxTextEntry:
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }

View File

@@ -171,7 +171,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
void wxComboBox::SetActualValue(const wxString &value)
{
if ( HasFlag(wxCB_READONLY) )
if ( IsReadOnly() )
{
SetStringSelection( value );
}
@@ -182,10 +182,17 @@ void wxComboBox::SetActualValue(const wxString &value)
}
}
bool wxComboBox::IsReadOnly() const
{
return HasFlag( wxCB_READONLY );
}
void wxComboBox::SetValue(const wxString& value)
{
SetActualValue( value );
SetInsertionPoint( 0 );
if ( !IsReadOnly() )
SetInsertionPoint( 0 );
}
void wxComboBox::ChangeValue(const wxString &value)
@@ -249,7 +256,9 @@ void wxComboBox::Dismiss()
void wxComboBox::Clear()
{
wxTextEntry::Clear();
if ( !IsReadOnly() )
wxTextEntry::Clear();
wxItemContainer::Clear();
}