diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-11-06 22:03:42 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-11-07 09:53:50 +0100 |
commit | 6e2dd3bed69355c028c2378bce81b98f390b50b2 (patch) | |
tree | 1e4a97503a46145b4451fdff76942c930d55c67e /vcl/qt5 | |
parent | 5c85ef3df01daf7848753fe33f254aeb3d1dd8e6 (diff) |
tdf#130857 qt weld: Implement QtInstanceWidget::{g,s}et_size_request
As described at [1], gtk_widget_set_size_request sets the
minimum size. Therefore, get/set the QWidget::minimumSize
property [2] for the QtInstanceWidget implementation using
a native QWidget.
[1] https://docs.gtk.org/gtk3/method.Widget.set_size_request.html
[2] https://doc.qt.io/qt-6/qwidget.html#minimumSize-prop
Change-Id: I38b9d02b81ed209b2acc94c2b9b015f32c6eec79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176172
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/QtInstanceWidget.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index 6764c83422d2..4f5a4e5f06d2 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -184,9 +184,20 @@ void QtInstanceWidget::hide() m_pWidget->hide(); } -void QtInstanceWidget::set_size_request(int, int) {} +void QtInstanceWidget::set_size_request(int nWidth, int nHeight) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pWidget->setMinimumSize(nWidth, nHeight); }); +} -Size QtInstanceWidget::get_size_request() const { return Size(); } +Size QtInstanceWidget::get_size_request() const +{ + SolarMutexGuard g; + + Size aSize; + GetQtInstance().RunInMainThread([&] { aSize = toSize(m_pWidget->minimumSize()); }); + return aSize; +} Size QtInstanceWidget::get_preferred_size() const { |