diff --git a/include/wx/qt/dialog.h b/include/wx/qt/dialog.h index afd9a8b080..8bd995d906 100644 --- a/include/wx/qt/dialog.h +++ b/include/wx/qt/dialog.h @@ -34,6 +34,7 @@ public: virtual int ShowModal() wxOVERRIDE; virtual void EndModal(int retCode) wxOVERRIDE; virtual bool IsModal() const wxOVERRIDE; + virtual bool Show(bool show) wxOVERRIDE; QDialog *GetDialogHandle() const; diff --git a/src/qt/dialog.cpp b/src/qt/dialog.cpp index a4c53444bc..f19fd41f63 100644 --- a/src/qt/dialog.cpp +++ b/src/qt/dialog.cpp @@ -74,7 +74,12 @@ int wxDialog::ShowModal() WX_HOOK_MODAL_DIALOG(); wxCHECK_MSG( GetHandle() != NULL, -1, "Invalid dialog" ); - bool ret = GetDialogHandle()->exec(); + QDialog *qDialog = GetDialogHandle(); + qDialog->setModal(true); + + Show(true); + + bool ret = qDialog->exec(); if ( GetReturnCode() == 0 ) return ret ? wxID_OK : wxID_CANCEL; return GetReturnCode(); @@ -95,6 +100,25 @@ bool wxDialog::IsModal() const return GetDialogHandle()->isModal(); } +bool wxDialog::Show(bool show) +{ + if ( show == IsShown() ) + return false; + + if ( !show && IsModal() ) + EndModal(wxID_CANCEL); + + if ( show && CanDoLayoutAdaptation() ) + DoLayoutAdaptation(); + + const bool ret = wxDialogBase::Show(show); + + if (show) + InitDialog(); + + return ret; +} + QDialog *wxDialog::GetDialogHandle() const { return static_cast(m_qtWindow);