vcl/qt5/QtBuilder.cxx | 24 ++++++++++++++++++++---- vcl/qt5/QtInstanceBuilder.cxx | 1 + 2 files changed, 21 insertions(+), 4 deletions(-)
New commits: commit 178430733b0687a0f9334dda9a66e9b58ec8e7b0 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Sep 28 00:43:21 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Sep 28 09:36:14 2024 +0200 tdf#130857 qt weld: Declare support for "License Information" dialog Now that previous commits have implemented what's needed to display the dialog and for button clicks to result in the expected action, add the .ui file for the "Help" -> "License Information" dialog to the list of supported .ui files for QtInstanceBuilder, so native Qt widgets will be used for that one with the Qt-based VCL plugins unless starting LO with the SAL_VCL_QT_NO_WELDED_WIDGETS environment variable set. Change-Id: I8a2dff1c751739567a3c9c0728e3357859069a9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174080 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index ee40033cfa86..4e791d771125 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -33,6 +33,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) // weld API at once. static std::unordered_set<OUString> aSupportedUIFiles = { u"modules/swriter/ui/inforeadonlydialog.ui"_ustr, + u"sfx/ui/licensedialog.ui"_ustr, u"sfx/ui/querysavedialog.ui"_ustr, }; commit 08b55df5c9e42c1ccb78a156261811875629342a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Sep 28 00:32:15 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Sep 28 09:36:07 2024 +0200 tdf#130857 qt weld: Close dialog on button click For QDialogs (created for "GtkDialog" objects in .ui files) that have a button box, let clicking any of the buttons that have a response code set close the dialog with that response code by connecting to the QAbstractButton::clicked signal. This addresses the remaining aspect for the "Help" -> "License Information" dialog mentioned in earlier commit Change-Id: Ic9393755ec474f77ff22a1115e3cccba9d7b26cb Author: Michael Weghorn <m.wegh...@posteo.de> Date: Sat Sep 28 00:07:28 2024 +0200 tdf#130857 qt weld: Add initial support for dialog and label > However, currently (...) clicking the buttons doesn't yet have any > effect. Actually using Qt(InstanceBuilder) for that dialog will be enabled in an upcoming commit. Change-Id: Ie3c26963318fd5832688e3ed73f6952e09da4bb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174079 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 63fa67869d6d..ce36fab8925d 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -165,20 +165,36 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons void QtBuilder::tweakInsertedChild(QObject*, QObject* pCurrentChild, std::string_view, std::string_view) { - // ensure that button box is the last item in QDialog's layout - // (that seems to be implicitly the case for GtkDialog) - // no action needed for QMessageBox, where the default button box is used, - // which is at the right place if (QDialog* pDialog = qobject_cast<QDialog*>(pCurrentChild)) { + // no action needed for QMessageBox, where the default button box is used + // and button click is handled in QtInstanceMessageDialog if (!qobject_cast<QMessageBox*>(pDialog)) { if (QDialogButtonBox* pButtonBox = findButtonBox(pDialog)) { + // ensure that button box is the last item in QDialog's layout + // (that seems to be implicitly the case for GtkDialog in GTK) QLayout* pLayout = pDialog->layout(); assert(pLayout && "dialog has no layout"); pLayout->removeWidget(pButtonBox); pLayout->addWidget(pButtonBox); + + // let button click close dialog if response code is set + const QList<QAbstractButton*> aButtons = pButtonBox->buttons(); + for (const QAbstractButton* pButton : aButtons) + { + QVariant aResponseProperty + = pButton->property(QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE); + if (aResponseProperty.isValid()) + { + assert(aResponseProperty.canConvert<int>()); + const int nResponseCode = aResponseProperty.toInt(); + QObject::connect( + pButton, &QAbstractButton::clicked, pDialog, + [pDialog, nResponseCode] { pDialog->done(nResponseCode); }); + } + } } } }