vcl/qt5/QtInstance.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 5fb127ffaf6628ac9a757638705948aa5cb94b55
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Sep 18 10:27:33 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Sep 18 20:01:56 2024 +0200

    tdf#130857 qt weld: Pass parent to QtInstanceBuilder
    
    Instead of always passing `nullptr` for the
    parent to the `QtInstanceBuilder`, use
    `QtInstance::GetNativeParentFromWeldParent` in order
    to find a QWidget that can be used for the parent.
    
    This makes the "Save Document?" dialog in the
    WIP Gerrit change [1] (patch set 24 that actually
    makes use of the parent) properly modal on top
    of the Writer window, so the dialog no longer
    disappears behind the Writer window when using
    Alt+Tab.
    
    [1] https://gerrit.libreoffice.org/c/core/+/161831
    
    Change-Id: I84de0c4808d76020103f10ebaacb03908a6ee815
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173594
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index fbfc06ac61ee..2243b3dec590 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -823,9 +823,14 @@ std::unique_ptr<weld::Builder>
 QtInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, 
const OUString& rUIFile)
 {
     if (!QtData::noWeldedWidgets() && 
QtInstanceBuilder::IsUIFileSupported(rUIFile))
-        return std::make_unique<QtInstanceBuilder>(nullptr, rUIRoot, rUIFile);
+    {
+        QWidget* pQtParent = GetNativeParentFromWeldParent(pParent);
+        return std::make_unique<QtInstanceBuilder>(pQtParent, rUIRoot, 
rUIFile);
+    }
     else
+    {
         return SalInstance::CreateBuilder(pParent, rUIRoot, rUIFile);
+    }
 }
 
 weld::MessageDialog* QtInstance::CreateMessageDialog(weld::Widget* pParent,

Reply via email to