summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-09-27 23:00:46 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-09-28 09:35:33 +0200
commitf14b6a9c2d906f11049326a69cd4bddd072ab626 (patch)
tree2b921da2033e12f38388b23ed826430f6afd248c /vcl
parent592665ce867d51ed3dcf95fd0f06fd22dc2804e8 (diff)
tdf#130857 qt weld: Use QDialog* as param for findButtonBox
Don't restrict to QMessageBox, but allow using the method with any QDialog, and don't assert that the dialog has a layout set in this case. The method will be reused in an upcoming commit. Change-Id: I1992f2eb4f34b25e487bbd349631b6ecd4365c95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174075 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/qt5/QtBuilder.hxx2
-rw-r--r--vcl/qt5/QtBuilder.cxx10
2 files changed, 7 insertions, 5 deletions
diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx
index 3617f45f57fd..6ae06e3536b8 100644
--- a/vcl/inc/qt5/QtBuilder.hxx
+++ b/vcl/inc/qt5/QtBuilder.hxx
@@ -70,7 +70,7 @@ public:
private:
static void setProperties(QObject* obj, stringmap& rProps);
static QWidget* windowForObject(QObject* pObject);
- static QDialogButtonBox* findButtonBox(QMessageBox* pMessageBox);
+ static QDialogButtonBox* findButtonBox(QDialog* pDialog);
};
template <typename T> inline T* QtBuilder::get(std::u16string_view sID)
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 5d434dc58d71..36eaa3f6e96e 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -236,11 +236,13 @@ QWidget* QtBuilder::windowForObject(QObject* pObject)
return nullptr;
}
-QDialogButtonBox* QtBuilder::findButtonBox(QMessageBox* pMessageBox)
+QDialogButtonBox* QtBuilder::findButtonBox(QDialog* pDialog)
{
- assert(pMessageBox);
- QLayout* pLayout = pMessageBox->layout();
- assert(pLayout && "QMessageBox has no layout");
+ assert(pDialog);
+ QLayout* pLayout = pDialog->layout();
+ if (!pLayout)
+ return nullptr;
+
for (int i = 0; i < pLayout->count(); i++)
{
QLayoutItem* pItem = pLayout->itemAt(i);