diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-22 00:12:13 +0100 |
---|---|---|
committer | Michael Weghorn (away) <m.weghorn@posteo.de> | 2024-12-22 11:40:22 +0100 |
commit | bb111c22a6093ec1f5edc5890d7ec6d238362c02 (patch) | |
tree | e1088ace7bef600871635a1e88572f059305e890 /vcl/qt5 | |
parent | 342470f03960274da41c608fc87688f3954d08fb (diff) |
tdf#130857 qt weld: Implement QtInstanceWidget::get_pixel_size
Change-Id: I082430e653f5634ecdcc101b370f531b2c0e25cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179097
Tested-by: Jenkins
Reviewed-by: Michael Weghorn (away) <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/QtInstanceWidget.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index 8f1d5075a79c..48e4c9b77fa9 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -233,10 +233,15 @@ int QtInstanceWidget::get_text_height() const return nHeight; } -Size QtInstanceWidget::get_pixel_size(const OUString&) const +Size QtInstanceWidget::get_pixel_size(const OUString& rText) const { - assert(false && "Not implemented yet"); - return Size(); + SolarMutexGuard g; + + Size aSize; + GetQtInstance().RunInMainThread( + [&] { aSize = toSize(m_pWidget->fontMetrics().boundingRect(toQString(rText)).size()); }); + + return aSize; } vcl::Font QtInstanceWidget::get_font() |