@@ -924,6 +924,9 @@ void BitcoinGUI::optionsClicked()
924924
925925 OptionsDialog dlg (this , enableWallet);
926926 dlg.setModel (clientModel->getOptionsModel ());
927+ connect (&dlg, &OptionsDialog::appearanceChanged, [=]() {
928+ updateWidth ();
929+ });
927930 dlg.exec ();
928931
929932 updatePrivateSendVisibility ();
@@ -1171,6 +1174,26 @@ void BitcoinGUI::updatePrivateSendVisibility()
11711174 privateSendCoinsMenuAction->setVisible (fEnabled );
11721175 showPrivateSendHelpAction->setVisible (fEnabled );
11731176 updateToolBarShortcuts ();
1177+ updateWidth ();
1178+ }
1179+
1180+ void BitcoinGUI::updateWidth ()
1181+ {
1182+ int nWidthWidestButton{0 };
1183+ int nButtonsVisible{0 };
1184+ for (QAbstractButton* button : tabGroup->buttons ()) {
1185+ if (!button->isEnabled ()) {
1186+ continue ;
1187+ }
1188+ QFontMetrics fm (button->font ());
1189+ nWidthWidestButton = std::max<int >(nWidthWidestButton, fm.width (button->text ()));
1190+ ++nButtonsVisible;
1191+ }
1192+ // Add 30 per button as padding and use minimum 980 which is the minimum required to show all tab's contents
1193+ // Use nButtonsVisible + 1 <- for the dash logo
1194+ int nWidth = std::max<int >(980 , (nWidthWidestButton + 30 ) * (nButtonsVisible + 1 ));
1195+ setMinimumWidth (nWidth);
1196+ setMaximumWidth (nWidth);
11741197}
11751198
11761199void BitcoinGUI::updateToolBarShortcuts ()
@@ -1490,6 +1513,10 @@ void BitcoinGUI::showEvent(QShowEvent *event)
14901513 openRepairAction->setEnabled (true );
14911514 aboutAction->setEnabled (true );
14921515 optionsAction->setEnabled (true );
1516+
1517+ if (!event->spontaneous ()) {
1518+ updateWidth ();
1519+ }
14931520}
14941521
14951522#ifdef ENABLE_WALLET
0 commit comments