vcl/qt5/QtBuilder.cxx |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

New commits:
commit b021286327abed031e75b6dd6fa67790f24a700a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Sep 28 22:19:53 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Sep 30 08:23:12 2024 +0200

    tdf#130857 qt a11y weld: Set GtkBuilder ID as widget's accessible ID
    
    Set the GtkBuilder ID specified in .ui files as the accessible
    ID for the QWidget created for the object, in line with what
    happens for other implementations as well. This is basically
    the equivalent of
    
        commit c64b823b74cbd3063d6e87643bd68ea5343b2f54
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Tue Jul 16 13:57:41 2024 +0200
    
            tdf#155447 qt a11y: Report accessible ID
    
    for the case where native Qt widgets are used instead of
    vcl::Window.
    
    Other than QWidget, QLayout is not part of the a11y
    hierarchy of an application, so there's nothing to
    do for these.
    
    This e.g. makes Accerciser show an accessible ID of
    "LicenseDialog" for the "Help" -> "License Information"
    dialog.
    
    The accessible ID set this way currently isn't reported
    on the AT-SPI level for QMessageBox (e.g. the "Save Document?"
    dialog) however. Suggested upstream change to make that
    work as well: [1]
    
    [1] https://codereview.qt-project.org/c/qt/qtbase/+/594390
    
    Change-Id: I50e8ca6f8bea628df5a80d101c4a0a7bfded9c19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174158
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 3d702f34c250..4845d70209bf 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -149,12 +149,16 @@ QObject* QtBuilder::makeObject(QObject* pParent, 
std::u16string_view sName, cons
         assert(false && "Widget type not supported yet");
     }
 
-    // add widgets to parent layout
-    if (pParentLayout)
+    if (QWidget* pWidget = qobject_cast<QWidget*>(pObject))
     {
-        QWidget* pWidget = qobject_cast<QWidget*>(pObject);
-        if (pWidget)
+        // add widget to parent layout
+        if (pParentLayout)
             pParentLayout->addWidget(pWidget);
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
+        // Set GtkBuilder ID as accessible ID
+        pWidget->setAccessibleIdentifier(toQString(sID));
+#endif
     }
 
     m_aChildren.emplace_back(sID, pObject);
commit a44d515dd61f8e715c86ce1f05c3b4117a10c50d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Sep 28 20:35:42 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Sep 30 08:23:05 2024 +0200

    tdf#130857 qt weld: Set dialog title and modality
    
    If the "title" or "modal" properties are set,
    set the dialog title/modality for the QDialog
    accordingly.
    
    This makes the "Help" -> "License Information" dialog show
    the "Licensing and Legal information" title for the native
    Qt dialog as well, which gets used by default
    for the Qt-based VCL plugins since
    
        commit 178430733b0687a0f9334dda9a66e9b58ec8e7b0
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Sat Sep 28 00:43:21 2024 +0200
    
            tdf#130857 qt weld: Declare support for "License Information" dialog
    
    Change-Id: I5c89eef04967d6d456474600f860dca19a6009e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174154
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index ce36fab8925d..3d702f34c250 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -257,6 +257,16 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& 
rProps)
             }
         }
     }
+    else if (QDialog* pDialog = qobject_cast<QDialog*>(pObject))
+    {
+        for (auto const & [ rKey, rValue ] : rProps)
+        {
+            if (rKey == u"modal")
+                pDialog->setModal(toBool(rValue));
+            else if (rKey == u"title")
+                pDialog->setWindowTitle(toQString(rValue));
+        }
+    }
     else if (QLabel* pLabel = qobject_cast<QLabel*>(pObject))
     {
         for (auto const & [ rKey, rValue ] : rProps)

Reply via email to