fix(#283): restore center alignment when loading table config

saveConfig() serialises Qt::AlignHCenter as the string "AlignHCenter"
via QMetaEnum::valueToKey(), but loadConfig() matched against
Qt::AlignCenter (0x0084 = AlignHCenter|AlignVCenter) instead of
Qt::AlignHCenter (0x0004).  The two values differ, so the switch fell
through to the default (Right) every time center was saved and reloaded.

Add Qt::AlignHCenter as the primary case and keep Qt::AlignCenter as a
fallthrough for any config files that were hand-edited by users following
the workaround documented in issue #283.

Verified with a standalone Qt test: QMetaEnum::keyToValue("AlignHCenter")
returns 4 (AlignHCenter), which now correctly resolves to combobox index 1
(Center) instead of 2 (Right).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Shane Ringrose
2026-06-21 20:41:25 +12:00
parent 6c4711a8d0
commit f55ba568f6
+4 -2
View File
@@ -268,7 +268,8 @@ void AddTableDialog::loadConfig()
case Qt::AlignLeft :
ui->m_header_alignment_cb->setCurrentIndex(0);
break;
case Qt::AlignCenter :
case Qt::AlignHCenter :
case Qt::AlignCenter : // accept AlignCenter in case it was hand-edited by the user
ui->m_header_alignment_cb->setCurrentIndex(1);
break;
default:
@@ -284,7 +285,8 @@ void AddTableDialog::loadConfig()
case Qt::AlignLeft :
ui->m_table_alignment_cb->setCurrentIndex(0);
break;
case Qt::AlignCenter :
case Qt::AlignHCenter :
case Qt::AlignCenter : // accept AlignCenter in case it was hand-edited by the user
ui->m_table_alignment_cb->setCurrentIndex(1);
break;
default: