tdf#130857 qt weld: Create QGridLayout for "GtkGrid"

Create a QGridLayout [1] when encountering a "GtkGrid"
object in a .ui file.

This will be needed e.g. by Writer's "Tools" -> "Word Count"
dialog.

With this commit in place, adding "modules/swriter/ui/wordcount.ui"
to the list of supported .ui files in
QtInstanceBuilder::IsUIFileSupported would already result in each of
the labels in the dialog showing up, but each one as a single row rather
than they being properly arranged in rows and columns.
(That will be handled in an upcoming commit.)

[1] https://doc.qt.io/qt-6/qgridlayout.html

Change-Id: Ib9a9de4aa2820ac7e6771acf884072768508fe59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175365
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2024-10-21 18:16:22 +02:00
parent 7a7b1f9cbd
commit afb980283a

View file

@ -17,6 +17,7 @@
#include <QtWidgets/QCheckBox> #include <QtWidgets/QCheckBox>
#include <QtWidgets/QDialog> #include <QtWidgets/QDialog>
#include <QtWidgets/QDialogButtonBox> #include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QGroupBox> #include <QtWidgets/QGroupBox>
#include <QtWidgets/QLabel> #include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit> #include <QtWidgets/QLineEdit>
@ -155,6 +156,10 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons
{ {
pObject = new QGroupBox(pParentWidget); pObject = new QGroupBox(pParentWidget);
} }
else if (sName == u"GtkGrid")
{
pObject = new QGridLayout(pParentWidget);
}
else if (sName == u"GtkLabel") else if (sName == u"GtkLabel")
{ {
extractMnemonicWidget(sID, rMap); extractMnemonicWidget(sID, rMap);