diff --git a/include/wx/qt/radiobox.h b/include/wx/qt/radiobox.h index 2c84083aa3..679298b83b 100644 --- a/include/wx/qt/radiobox.h +++ b/include/wx/qt/radiobox.h @@ -68,6 +68,7 @@ public: virtual bool Enable(unsigned int n, bool enable = true) wxOVERRIDE; virtual bool Enable(bool enable = true) wxOVERRIDE; virtual bool Show(unsigned int n, bool show = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; virtual bool IsItemEnabled(unsigned int n) const wxOVERRIDE; virtual bool IsItemShown(unsigned int n) const wxOVERRIDE; diff --git a/src/qt/radiobox.cpp b/src/qt/radiobox.cpp index b02c5a1596..b8c82a8a37 100644 --- a/src/qt/radiobox.cpp +++ b/src/qt/radiobox.cpp @@ -217,10 +217,43 @@ bool wxRadioBox::Enable( bool enable ) bool wxRadioBox::Show(unsigned int n, bool show) { - QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n ); - CHECK_BUTTON( qtButton, false ); + if ( show && !m_qtGroupBox->isVisible() ) + { + m_qtGroupBox->setVisible(true); + + for ( unsigned int i = 0; i < GetCount(); ++i ) + { + QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, i ); + CHECK_BUTTON( qtButton, false ); + + i == n ? qtButton->setVisible( true ) : qtButton->setVisible( false ); + } + } + else + { + QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n ); + CHECK_BUTTON( qtButton, false ); + + qtButton->setVisible( show ); + } + + return true; +} + +bool wxRadioBox::Show( bool show ) +{ + if( m_qtGroupBox->isVisible() == show ) + { + for( unsigned int i = 0; i < GetCount(); ++i ) + { + QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, i ); + CHECK_BUTTON( qtButton, false ); + qtButton->setVisible( show ); + } + } + + m_qtGroupBox->setVisible( show ); - qtButton->setVisible( show ); return true; }