vcl/qt5/QtBuilder.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 7199e9a0d5313b253734fea5575ba00eceb2ecd8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Oct 25 22:53:14 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Oct 26 13:19:51 2024 +0200

    tdf#130857 qt weld: Evaluate + set grid item row/col span
    
    When processing packing properties for grid items,
    also take the "width" and "height" properties into account,
    which specify the column span and row span, respectively.
    
    Pass these as params as well when re-adding the item
    to the grid, not just the row/col index.
    
    With this in place, when opening the "Help" -> "About LibreOfficeDev"
    dialog in a WIP branch adding "cui/ui/aboutdialog.ui" to the list
    of .ui files in QtInstanceBuilder::IsUIFileSupported, the
    "imAbout" image on the left hand side of the dialog is now no longer
    restricted to the top left cell in the grid, but uses more space
    as expected.
    
    Change-Id: Ia2edb147d7576d863d597c01d4d310e8798a9ecc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175668
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index edb58b16700a..be135bb5b41f 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -356,18 +356,24 @@ void QtBuilder::applyGridPackingProperties(QObject* 
pCurrentChild, QGridLayout&
     const sal_Int32 nColumn = 
rPackingProperties.at(u"left-attach"_ustr).toInt32();
     const sal_Int32 nRow = rPackingProperties.at(u"top-attach"_ustr).toInt32();
 
+    auto aWidthIt = rPackingProperties.find(u"width"_ustr);
+    sal_Int32 nColumnSpan = (aWidthIt == rPackingProperties.end()) ? 1 : 
aWidthIt->second.toInt32();
+
+    auto aHeightIt = rPackingProperties.find(u"height"_ustr);
+    sal_Int32 nRowSpan = (aHeightIt == rPackingProperties.end()) ? 1 : 
aHeightIt->second.toInt32();
+
     if (pCurrentChild->isWidgetType())
     {
         QWidget* pWidget = static_cast<QWidget*>(pCurrentChild);
         rGrid.removeWidget(pWidget);
-        rGrid.addWidget(pWidget, nRow, nColumn);
+        rGrid.addWidget(pWidget, nRow, nColumn, nRowSpan, nColumnSpan);
         return;
     }
 
     // if it's not a QWidget, it must be a QLayout
     QLayout* pLayout = static_cast<QLayout*>(pCurrentChild);
     rGrid.removeItem(pLayout);
-    rGrid.addLayout(pLayout, nRow, nColumn);
+    rGrid.addLayout(pLayout, nRow, nColumn, nRowSpan, nColumnSpan);
 }
 
 void QtBuilder::applyPackingProperties(QObject* pCurrentChild, QObject* 
pParent,

Reply via email to