vcl/inc/qt5/QtInstance.hxx        |    3 +++
 vcl/inc/qt5/QtInstanceBuilder.hxx |    1 +
 vcl/qt5/QtInstance.cxx            |   23 +++++++++++++++++++++++
 vcl/qt5/QtInstanceBuilder.cxx     |    6 ++++++
 4 files changed, 33 insertions(+)

New commits:
commit 4acb564b7683e9394926b3c509c904bd21a80b8d
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Feb 3 15:56:17 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Feb 3 23:09:26 2026 +0100

    tdf#130857 qt weld: Support Form Navigator
    
    This means that native Qt widgets are used for that dialog
    now when using the qt5 or qt6 VCL plugin and starting LO with
    environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set.
    
    The dialog can be triggered like this:
    
    * start Writer
    * "Form" -> "Form Navigator..."
    
    This is the first case for native Qt widgets created using
    the interim builder (QtInstance::CreateInterimBuilder)
    for which support was added in previous commit
    
        Change-Id: I5a9c65918fe6bd7f5da0e4976d842a68052dec6f
        Author: Michael Weghorn <[email protected]>
        Date:   Tue Feb 3 15:48:31 2026 +0100
    
            tdf#130857 qt weld: Add initial support for interim builder
    
    Change-Id: Ic44aa008c7bfc5ebf3d4428d0e59373e45900d20
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198608
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index e87c875e25f0..f5bc7ac43238 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -337,6 +337,7 @@ constexpr auto SUPPORTED_WITH_QT_PARENT = 
frozen::make_unordered_set<std::u16str
     u"svt/ui/datewindow.ui",
     u"svt/ui/linewindow.ui",
     u"svx/ui/colorwindow.ui",
+    u"svx/ui/formnavigator.ui",
     u"svx/ui/formnavimenu.ui",
     u"vcl/ui/editmenu.ui",
     u"xmlsec/ui/certdetails.ui",
commit 013304cdcfd96a0bcd7ebee3c478324e7d6a561c
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Feb 3 15:48:31 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Feb 3 23:09:18 2026 +0100

    tdf#130857 qt weld: Add initial support for interim builder
    
    Add QtInstance::CreateInterimBuilder that overrides the
    base class implementation in a similar way to how
    GtkInstance::CreateInterimBuilder does it for the gtk3
    VCL plugin:
    
    Create a SystemChildWindow which is known to have
    a QWidget and embed the widget tree from the .ui
    file into that widget.
    
    Do the same as for the non-interim builder and
    only support .ui files explicitly added to a
    whitelist, so implementing support can be
    done incrementally (one window/.ui file/... at a
    time).
    Reuse the existing set of .ui files for non-top-levels
    supported as children of native Qt widgets.
    
    This adds the initial logic. An upcoming commit
    will make use of this by declaring support for
    Writer's "Form" -> "Form Navigator..." dialog.
    
    Implementing that the widgets created by the interim
    builder are also reported as accessible children
    of their parent vcl widget in the a11y tree will
    still have to be done separately.
    
    Change-Id: I5a9c65918fe6bd7f5da0e4976d842a68052dec6f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198607
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
index ed2016df0a89..51974900a1db 100644
--- a/vcl/inc/qt5/QtInstance.hxx
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -188,6 +188,9 @@ public:
 
     std::unique_ptr<weld::Builder> CreateBuilder(weld::Widget* pParent, const 
OUString& rUIRoot,
                                                  const OUString& rUIFile) 
override;
+    virtual std::unique_ptr<weld::Builder>
+    CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const 
OUString& rUIFile,
+                         bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 
0) override;
     virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
                                                      VclMessageType 
eMessageType,
                                                      VclButtonsType 
eButtonType,
diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx 
b/vcl/inc/qt5/QtInstanceBuilder.hxx
index 19627d0fe908..4f42eeaa7dc1 100644
--- a/vcl/inc/qt5/QtInstanceBuilder.hxx
+++ b/vcl/inc/qt5/QtInstanceBuilder.hxx
@@ -41,6 +41,7 @@ public:
     ~QtInstanceBuilder();
 
     static bool IsUIFileSupported(const OUString& rUIFile, const weld::Widget* 
pParent);
+    static bool IsInterimUIFileSupported(const OUString& rUIFile);
 
     virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const 
OUString& id) override;
     virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString& rId) 
override;
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index 8606f52a2ba3..37786c5d7e49 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -932,6 +932,29 @@ QtInstance::CreateBuilder(weld::Widget* pParent, const 
OUString& rUIRoot, const
     }
 }
 
+std::unique_ptr<weld::Builder> QtInstance::CreateInterimBuilder(vcl::Window* 
pParent,
+                                                                const 
OUString& rUIRoot,
+                                                                const 
OUString& rUIFile,
+                                                                bool 
bAllowCycleFocusOut,
+                                                                sal_uInt64 
nLOKWindowId)
+{
+    if (!QtInstanceBuilder::IsInterimUIFileSupported(rUIFile))
+        return SalInstance::CreateInterimBuilder(pParent, rUIRoot, rUIFile, 
bAllowCycleFocusOut,
+                                                 nLOKWindowId);
+
+    VclPtr<SystemChildWindow> pEmbedWindow = 
VclPtr<SystemChildWindow>::Create(pParent, 0);
+    pEmbedWindow->Show(true, ShowFlags::NoActivate);
+    pEmbedWindow->set_expand(true);
+
+    const SystemEnvData* pEnvData = pEmbedWindow->GetSystemData();
+    assert(pEnvData);
+
+    QWidget* pWidget = static_cast<QWidget*>(pEnvData->pWidget);
+    pWidget->show();
+
+    return std::make_unique<QtInstanceBuilder>(pWidget, rUIRoot, rUIFile);
+}
+
 weld::MessageDialog* QtInstance::CreateMessageDialog(weld::Widget* pParent,
                                                      VclMessageType 
eMessageType,
                                                      VclButtonsType 
eButtonsType,
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 0ecd19403950..e87c875e25f0 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -360,6 +360,11 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile, const weld::W
            && dynamic_cast<const QtInstanceWidget*>(pParent);
 }
 
+bool QtInstanceBuilder::IsInterimUIFileSupported(const OUString& rUIFile)
+{
+    return SUPPORTED_WITH_QT_PARENT.contains(rUIFile);
+}
+
 std::unique_ptr<weld::MessageDialog> 
QtInstanceBuilder::weld_message_dialog(const OUString& id)
 {
     SolarMutexGuard g;

Reply via email to