Skip to content

Commit 7bd1bb8

Browse files
authored
Merge pull request doxygen#12109 from StackAndPointer/fix-language-switch-settings
fix: Under language settings other than English, after reading the configuration file, switching page settings will revert to default values.
2 parents 6f52d5b + 6c7c9f9 commit 7bd1bb8

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

addon/doxywizard/expert.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <QTextStream>
3838
#include <QFileInfo>
3939
#include <QRegularExpression>
40+
#include <QMap>
4041

4142
#define SA(x) QString::fromLatin1(x)
4243

@@ -1138,6 +1139,16 @@ void Expert::refresh()
11381139

11391140
void Expert::retranslateUi()
11401141
{
1142+
// Save current values before recreating widgets
1143+
QMap<QString, QVariant> savedValues;
1144+
for (auto it = m_options.constBegin(); it != m_options.constEnd(); ++it)
1145+
{
1146+
if (it.value())
1147+
{
1148+
savedValues.insert(it.key(), it.value()->value());
1149+
}
1150+
}
1151+
11411152
m_treeWidget->setHeaderLabels(QStringList() << DoxygenWizard::msgTopicsHeader());
11421153
m_prev->setText(DoxygenWizard::msgPreviousButton());
11431154
m_next->setText(DoxygenWizard::msgNextButton());
@@ -1157,6 +1168,31 @@ void Expert::retranslateUi()
11571168

11581169
createTopics(m_rootElement);
11591170

1171+
// Restore saved values to the newly created widgets
1172+
// Block signals to prevent triggering the changed() signal
1173+
bool wasBlocked = blockSignals(true);
1174+
for (auto it = savedValues.constBegin(); it != savedValues.constEnd(); ++it)
1175+
{
1176+
if (m_options.contains(it.key()) && m_options[it.key()])
1177+
{
1178+
Input *input = m_options[it.key()];
1179+
QObject *obj = dynamic_cast<QObject*>(input);
1180+
if (obj)
1181+
{
1182+
bool inputWasBlocked = obj->blockSignals(true);
1183+
input->value() = it.value();
1184+
input->update();
1185+
obj->blockSignals(inputWasBlocked);
1186+
}
1187+
else
1188+
{
1189+
input->value() = it.value();
1190+
input->update();
1191+
}
1192+
}
1193+
}
1194+
blockSignals(wasBlocked);
1195+
11601196
m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(0));
11611197

11621198
addConfigDocs(this);

0 commit comments

Comments
 (0)