Fix wxRadioBox::Show() behaviour in wxQt
If a QGroupBox is not visible, then you cannot set any of items to be visible. Update the implementation to match that expected by wx. Closes https://github.com/wxWidgets/wxWidgets/pull/1065
This commit is contained in:
parent
418a1b747e
commit
e7260cffe0
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user