@@ -118,6 +118,7 @@ AppearanceWidget::AppearanceWidget(QWidget* parent) :
118118 connect (ui->fontWeightNormalSlider , &QSlider::valueChanged, [this ](auto nValue) { updateFontWeightNormal (nValue); });
119119
120120 connect (ui->moneyFont , &QComboBox::currentTextChanged, [this ]() { Q_EMIT appearanceChanged (); });
121+ connect (ui->moneyFont , QOverload<int >::of (&QComboBox::currentIndexChanged), this , &AppearanceWidget::updateMoneyFont);
121122
122123 connect (ui->theme , &QComboBox::currentTextChanged, this , &AppearanceWidget::updateTheme);
123124 connect (ui->theme , &QComboBox::currentTextChanged, [this ]() { Q_EMIT appearanceChanged (); });
@@ -145,6 +146,13 @@ AppearanceWidget::~AppearanceWidget()
145146 if (prevWeightBold != GUIUtil::g_font_registry.GetWeightBold ()) {
146147 GUIUtil::g_font_registry.SetWeightBold (prevWeightBold);
147148 }
149+ // Restore monospace font if cancelled
150+ if (model) {
151+ const auto & current_money_font = model->data (model->index (OptionsModel::FontForMoney, 0 ), Qt::EditRole).value <OptionsModel::FontChoice>();
152+ if (current_money_font != prevMoneyFont) {
153+ model->setData (model->index (OptionsModel::FontForMoney, 0 ), QVariant::fromValue (prevMoneyFont));
154+ }
155+ }
148156 GUIUtil::setApplicationFont ();
149157 GUIUtil::updateFonts ();
150158 }
@@ -171,6 +179,7 @@ void AppearanceWidget::setModel(OptionsModel* _model)
171179 mapper->toFirst ();
172180
173181 const auto & font_for_money = _model->data (_model->index (OptionsModel::FontForMoney, 0 ), Qt::EditRole).value <OptionsModel::FontChoice>();
182+ prevMoneyFont = font_for_money; // Save original value for cancel
174183 setFontChoice (ui->moneyFont , font_for_money);
175184
176185 const bool override_family{_model->isOptionOverridden (" -font-family" )};
@@ -208,9 +217,7 @@ void AppearanceWidget::setModel(OptionsModel* _model)
208217void AppearanceWidget::accept ()
209218{
210219 fAcceptChanges = true ;
211- if (model) {
212- model->setData (model->index (OptionsModel::FontForMoney, 0 ), ui->moneyFont ->itemData (ui->moneyFont ->currentIndex ()));
213- }
220+ // Note: FontForMoney is now updated immediately via updateMoneyFont()
214221}
215222
216223void AppearanceWidget::updateTheme (const QString& theme)
@@ -282,6 +289,19 @@ void AppearanceWidget::updateMoneyPreview()
282289 ui->moneyFont_preview ->setFont (GUIUtil::getFontBold ());
283290}
284291
292+ void AppearanceWidget::updateMoneyFont (int index)
293+ {
294+ if (!model) {
295+ return ;
296+ }
297+ QVariant item_data = ui->moneyFont ->itemData (index);
298+ if (!item_data.canConvert <OptionsModel::FontChoice>()) {
299+ return ;
300+ }
301+ // Update the model immediately to trigger live preview in Overview page
302+ model->setData (model->index (OptionsModel::FontForMoney, 0 ), item_data);
303+ }
304+
285305void AppearanceWidget::updateWeightSlider (const bool fForce )
286306{
287307 int nMaximum = GUIUtil::g_font_registry.GetSupportedWeights ().size () - 1 ;
0 commit comments