Skip to content

Commit 35123a8

Browse files
committed
GUI/OptionsDialog: update invalid qvalidatedlineedit widget's invalid colors properly during theme change
1 parent 3274a10 commit 35123a8

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
@@ -1202,11 +1202,13 @@ void OptionsDialog::on_showTrayIcon_stateChanged(int state)
12021202

12031203
void OptionsDialog::changeEvent(QEvent* e)
12041204
{
1205+
// First let the base class update all child widget palettes
1206+
// required for qvalidatedlineedit invalid colors to update properly
1207+
QWidget::changeEvent(e);
12051208
if (e->type() == QEvent::PaletteChange) {
1209+
// Then update theme colors with the new palette
12061210
updateThemeColors();
12071211
}
1208-
1209-
QWidget::changeEvent(e);
12101212
}
12111213

12121214
bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
@@ -1331,6 +1333,13 @@ void OptionsDialog::updateThemeColors()
13311333
const QColor networkport_warning = networkport_dark ? QColor("#FF8080") : QColor("#FF0000");
13321334
ui->networkPort->setStyleSheet(QStringLiteral("color: %1;").arg(networkport_warning.name()));
13331335
}
1336+
// Re-trigger validation on all qvalidatedlineedit input fields to update their styling
1337+
// including background and text color
1338+
// Use setText to trigger validation
1339+
if (!ui->proxyIp->isValid()) ui->proxyIp->setText(ui->proxyIp->text());
1340+
if (!ui->proxyPort->isValid()) ui->proxyPort->setText(ui->proxyPort->text());
1341+
if (!ui->proxyIpTor->isValid()) ui->proxyIpTor->setText(ui->proxyIpTor->text());
1342+
if (!ui->proxyPortTor->isValid()) ui->proxyPortTor->setText(ui->proxyPortTor->text());
13341343
}
13351344

13361345
ProxyAddressValidator::ProxyAddressValidator(QObject *parent) :

0 commit comments

Comments
 (0)