tdf#130857 qt weld: Convert accelerators for check/radio buttons

Convert the accelerators between the Qt and VCL
version as needed.

In a WIP branch declaring support for the print dialog,
this makes the correct text show up instead of a literal
"~All Pages" for a radio button and "Page ba~ckground"
for a checkbox.

Change-Id: Ic73af5e654b00b4e6dae1d561465604c8e9b46c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188038
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2025-07-18 15:07:30 +02:00
parent 0b10ff07c1
commit e702e7972d
2 changed files with 8 additions and 4 deletions

View File

@ -40,13 +40,15 @@ TriState QtInstanceCheckButton::get_state() const
void QtInstanceCheckButton::set_label(const OUString& rText)
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pCheckBox->setText(toQString(rText)); });
GetQtInstance().RunInMainThread(
[&] { m_pCheckBox->setText(vclToQtStringWithAccelerator(rText)); });
}
OUString QtInstanceCheckButton::get_label() const
{
SolarMutexGuard g;
OUString sLabel;
GetQtInstance().RunInMainThread([&] { sLabel = toOUString(m_pCheckBox->text()); });
GetQtInstance().RunInMainThread(
[&] { sLabel = qtToVclStringWithAccelerator(m_pCheckBox->text()); });
return sLabel;
}

View File

@ -37,13 +37,15 @@ bool QtInstanceRadioButton::get_active() const
void QtInstanceRadioButton::set_label(const OUString& rText)
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pRadioButton->setText(toQString(rText)); });
GetQtInstance().RunInMainThread(
[&] { m_pRadioButton->setText(vclToQtStringWithAccelerator(rText)); });
}
OUString QtInstanceRadioButton::get_label() const
{
SolarMutexGuard g;
OUString sLabel;
GetQtInstance().RunInMainThread([&] { sLabel = toOUString(m_pRadioButton->text()); });
GetQtInstance().RunInMainThread(
[&] { sLabel = qtToVclStringWithAccelerator(m_pRadioButton->text()); });
return sLabel;
}