summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-11-06 23:39:53 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-11-07 09:54:32 +0100
commite5570ce8e936ab07e5f5f676d7043d8f32bf7306 (patch)
tree9537b31e79274f2e8bd52dfe2e7d937ddecb8630
parent37c6c3bdcdeed22e99fd89dbd2cfa3d8fda75f09 (diff)
tdf#130857 qt weld: Don't set negative min width/height
While gtk_widget_set_size_request supports -1 for the width/height as a special value to unset the requested minimum width/height [1], Qt doesn't, and warns when this gets passed. Therefore, ensure not to use negative values. [1] https://docs.gtk.org/gtk3/method.Widget.set_size_request.html Change-Id: I4ad6a3fa149138bcfdfeede1f2dc1bdfc5425e2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176178 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/qt5/QtInstanceWidget.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx
index 4f5a4e5f06d2..d556c1a4d7c8 100644
--- a/vcl/qt5/QtInstanceWidget.cxx
+++ b/vcl/qt5/QtInstanceWidget.cxx
@@ -187,7 +187,8 @@ void QtInstanceWidget::hide()
void QtInstanceWidget::set_size_request(int nWidth, int nHeight)
{
SolarMutexGuard g;
- GetQtInstance().RunInMainThread([&] { m_pWidget->setMinimumSize(nWidth, nHeight); });
+ GetQtInstance().RunInMainThread(
+ [&] { m_pWidget->setMinimumSize(std::max(0, nWidth), std::max(0, nHeight)); });
}
Size QtInstanceWidget::get_size_request() const