diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-10-25 22:53:14 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-10-26 13:19:51 +0200 |
commit | 7199e9a0d5313b253734fea5575ba00eceb2ecd8 (patch) | |
tree | c7b664c2fd89e105266df834c1b46b6b0cd1e25e /vcl | |
parent | e8e0a676b31596ce0d1fee7936ff934dfc9e3c09 (diff) |
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.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/QtBuilder.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
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, |