vcl/qt5/QtBuilder.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
New commits: commit c132233acfd5bdede5684ea2d224f62bebc13443 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Oct 28 09:48:15 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Oct 28 12:46:24 2024 +0100 tdf#130857 qt weld: Don't expect packing props on implicit grid When the "left-attach" or "top-attach" packing properties are not set in QtBuilder::applyGridPackingProperties, just skip processing, but don't trigger an assert. While these packing properties should be set for every child of a "GtkGrid" object in .ui files, there's also the special case of QMessageBox, which uses a QGridLayout for its layout whereas the .ui file for a "GtkMessageDialog" uses a "GtkBox" instead. (See the special handling for "GtkBox" in QtBuilder::makeObject, where the QMessageBox's existing layout is used instead of setting another one.) Therefore, gracefully handle the case where the properties are not set. Without this, the "Save Document?" dialog triggered the assert since commit 3e28b4f0c97d011cf4222941f019ce05fe6b0313 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Oct 25 21:21:25 2024 +0200 tdf#130857 qt weld: Simplify QtBuilder::applyGridPackingProperties Change-Id: I03bc9799c142563ffbf0fa3eadb58bc63e6e23f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175722 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index be135bb5b41f..a655e351117b 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -348,10 +348,12 @@ void QtBuilder::applyGridPackingProperties(QObject* pCurrentChild, QGridLayout& const stringmap& rPackingProperties) { assert(pCurrentChild); - assert(rPackingProperties.contains(u"left-attach"_ustr) - && "left-attach property missing for grid item"); - assert(rPackingProperties.contains(u"top-attach"_ustr) - && "top-attach property missing for grid item"); + + // properties not set when there's no explicit GtkGrid in the .ui file, + // like for the QGridLayout that's the (implicit) layout of a QMessageBox + if (!rPackingProperties.contains(u"left-attach"_ustr) + || !rPackingProperties.contains(u"top-attach"_ustr)) + return; const sal_Int32 nColumn = rPackingProperties.at(u"left-attach"_ustr).toInt32(); const sal_Int32 nRow = rPackingProperties.at(u"top-attach"_ustr).toInt32();