Select first item of wxRadioBox by default in wxQt too
Follow the other ports and select the first radio box item when it's created, to ensure that it always has selection. See https://github.com/wxWidgets/wxWidgets/pull/1065
This commit is contained in:
committed by
Vadim Zeitlin
parent
2a64b65149
commit
418a1b747e
@@ -111,11 +111,19 @@ template < typename Button >
|
|||||||
static void AddChoices( QButtonGroup *qtButtonGroup, QBoxLayout *qtBoxLayout, int count, const wxString choices[] )
|
static void AddChoices( QButtonGroup *qtButtonGroup, QBoxLayout *qtBoxLayout, int count, const wxString choices[] )
|
||||||
{
|
{
|
||||||
Button *btn;
|
Button *btn;
|
||||||
|
bool isFirst = true;
|
||||||
|
|
||||||
while ( count-- > 0 )
|
while ( count-- > 0 )
|
||||||
{
|
{
|
||||||
btn = new Button( wxQtConvertString( *choices++ ));
|
btn = new Button( wxQtConvertString( *choices++ ));
|
||||||
qtButtonGroup->addButton( btn );
|
qtButtonGroup->addButton( btn );
|
||||||
qtBoxLayout->addWidget( btn );
|
qtBoxLayout->addWidget( btn );
|
||||||
|
|
||||||
|
if ( isFirst )
|
||||||
|
{
|
||||||
|
btn->setChecked(true);
|
||||||
|
isFirst = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user