From 418a1b747e28614ca07e41f413b636a35fe2a3ef Mon Sep 17 00:00:00 2001 From: Liam Treacy Date: Mon, 10 Dec 2018 13:57:14 +0000 Subject: [PATCH] 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 --- src/qt/radiobox.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qt/radiobox.cpp b/src/qt/radiobox.cpp index beede99053..b02c5a1596 100644 --- a/src/qt/radiobox.cpp +++ b/src/qt/radiobox.cpp @@ -111,11 +111,19 @@ template < typename Button > static void AddChoices( QButtonGroup *qtButtonGroup, QBoxLayout *qtBoxLayout, int count, const wxString choices[] ) { Button *btn; + bool isFirst = true; + while ( count-- > 0 ) { btn = new Button( wxQtConvertString( *choices++ )); qtButtonGroup->addButton( btn ); qtBoxLayout->addWidget( btn ); + + if ( isFirst ) + { + btn->setChecked(true); + isFirst = false; + } } }