vcl/qt5/QtInstanceWidget.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 8a77f46f0ec8e360bab42dc59a952cebf2cc775b Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 11 17:37:38 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 11 19:45:43 2025 +0200 tdf#130857 qt weld: Implement QtInstanceWidget::get_font Reuse the existing toVclFont helper to get a vcl::Font for the QWidget's QFont. Fall back to the LO application font if that fails. Change-Id: I9394fb759c3d20ef35581689362afa713ad4033e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184059 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index 9429fccc6bdf..ac6bc39a44ed 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -12,6 +12,7 @@ #include <QtInstanceContainer.hxx> +#include <i18nlangtag/languagetag.hxx> #include <vcl/event.hxx> #include <vcl/transfer.hxx> #include <vcl/qt/QtUtils.hxx> @@ -248,8 +249,20 @@ Size QtInstanceWidget::get_pixel_size(const OUString& rText) const vcl::Font QtInstanceWidget::get_font() { - assert(false && "Not implemented yet"); - return vcl::Font(); + SolarMutexGuard g; + + vcl::Font aFont; + GetQtInstance().RunInMainThread([&] { + const QFont& rWidgetFont = getQWidget()->font(); + const css::lang::Locale& rLocale + = Application::GetSettings().GetUILanguageTag().getLocale(); + if (toVclFont(rWidgetFont, rLocale, aFont)) + return; + + aFont = Application::GetSettings().GetStyleSettings().GetAppFont(); + }); + + return aFont; } OUString QtInstanceWidget::get_buildable_name() const { return OUString(); }