Ensure that top level window is active when it's shown in wxQt

Under some (not totally clear) circumstances, a TLW can remain inactive
after being shown, which is undesirable, as it prevents setting focus to
its children from working.

Work around this by calling activateWindow() explicitly if necessary.

Closes https://github.com/wxWidgets/wxWidgets/pull/1179
This commit is contained in:
Matthew Griffin 2019-01-25 11:51:20 +00:00 committed by Vadim Zeitlin
parent aa22547b28
commit ae94f4da9c
2 changed files with 12 additions and 0 deletions

View File

@ -29,6 +29,7 @@ public:
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
virtual bool Show(bool show = true) wxOVERRIDE;
virtual void Maximize(bool maximize = true);
virtual void Restore();
virtual void Iconize(bool iconize = true);

View File

@ -62,6 +62,17 @@ bool wxTopLevelWindowQt::Create( wxWindow *parent, wxWindowID winId,
return true;
}
bool wxTopLevelWindowQt::Show(bool show)
{
if ( !wxTopLevelWindowBase::Show(show) )
return false;
if ( show && !m_qtWindow->isActiveWindow() )
m_qtWindow->activateWindow();
return true;
}
void wxTopLevelWindowQt::Maximize(bool maximize)
{
QWidget *widget = GetHandle();