Make wxTextEntry::DoSetValue() reusable under wxQt

This is a preparation for wxComboBox and wxBitmapComboBox to reuse the code
from the base class by just forwarding to wxTextEntry.
This commit is contained in:
ali kettab 2023-10-02 21:21:36 +01:00
parent 14ac76ed36
commit 7ec7fe6dea
2 changed files with 14 additions and 1 deletions

View file

@ -41,6 +41,9 @@ protected:
virtual void DoSetValue(const wxString& value, int flags=0) override;
virtual wxWindow *GetEditableWindow() override;
// Block/unblock the corresponding Qt signal.
virtual void EnableTextChangedEvents(bool enable) override;
};
#endif // _WX_QT_TEXTENTRY_H_

View file

@ -11,6 +11,7 @@
#include "wx/textentry.h"
#include "wx/window.h"
#include <QtWidgets/QWidget>
wxTextEntry::wxTextEntry()
{
@ -104,11 +105,20 @@ wxString wxTextEntry::DoGetValue() const
return wxString();
}
void wxTextEntry::DoSetValue(const wxString &WXUNUSED(value), int WXUNUSED(flags))
void wxTextEntry::DoSetValue(const wxString& value, int flags)
{
wxTextEntryBase::DoSetValue(value, flags);
}
wxWindow *wxTextEntry::GetEditableWindow()
{
return nullptr;
}
void wxTextEntry::EnableTextChangedEvents(bool enable)
{
wxWindow* const win = GetEditableWindow();
if ( win )
win->GetHandle()->blockSignals(!enable);
}