Skip to content

Commit b379c2c

Browse files
committed
GUI/OptionsDialog: update invalid qvalidatedlineedit widget's invalid colors properly during theme change
1 parent f24775a commit b379c2c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/qt/optionsdialog.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,11 +1188,13 @@ void OptionsDialog::on_showTrayIcon_stateChanged(int state)
11881188

11891189
void OptionsDialog::changeEvent(QEvent* e)
11901190
{
1191+
// First let the base class update all child widget palettes
1192+
// required for qvalidatedlineedit invalid colors to update properly
1193+
QWidget::changeEvent(e);
11911194
if (e->type() == QEvent::PaletteChange) {
1195+
// Then update theme colors with the new palette
11921196
updateThemeColors();
11931197
}
1194-
1195-
QWidget::changeEvent(e);
11961198
}
11971199

11981200
void OptionsDialog::togglePruneWarning(bool enabled)
@@ -1308,6 +1310,13 @@ void OptionsDialog::updateThemeColors()
13081310
const QColor networkport_warning = networkport_dark ? QColor("#FF8080") : QColor("#FF0000");
13091311
ui->networkPort->setStyleSheet(QStringLiteral("color: %1;").arg(networkport_warning.name()));
13101312
}
1313+
// Re-trigger validation on all qvalidatedlineedit input fields to update their styling
1314+
// including background and text color
1315+
// Use setText to trigger validation
1316+
if (!ui->proxyIp->isValid()) ui->proxyIp->setText(ui->proxyIp->text());
1317+
if (!ui->proxyPort->isValid()) ui->proxyPort->setText(ui->proxyPort->text());
1318+
if (!ui->proxyIpTor->isValid()) ui->proxyIpTor->setText(ui->proxyIpTor->text());
1319+
if (!ui->proxyPortTor->isValid()) ui->proxyPortTor->setText(ui->proxyPortTor->text());
13111320
}
13121321

13131322
ProxyAddressValidator::ProxyAddressValidator(QObject *parent) :

0 commit comments

Comments
 (0)