vcl/inc/qt5/QtInstanceDialog.hxx |    4 ++--
 vcl/inc/qt5/QtInstanceWindow.hxx |    7 ++++++-
 vcl/qt5/QtInstanceDialog.cxx     |    3 ++-
 vcl/qt5/QtInstanceWindow.cxx     |   13 +++++++++++--
 4 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit d76d4df7ea1db0fdd27d350119ff7c0b2024b6e1
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 23 13:45:48 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 24 17:14:37 2024 +0100

    tdf#154381 qt weld: Implement QtInstanceWindow::{g,s}et_title
    
    Implement methods to set and get the window title.
    
    In order to do that, add a `m_pWidget` member to
    `QtInstanceWindow`. For the `QtInstanceDialog` case, that widget
    is a pointer to the same dialog that `QtInstanceDialog::m_pDialog`
    points to, which is a unique_ptr and thus takes care of the memory
    management.
    
    The non-dialog case is not supported yet, s.a. this commit
    adding support for simple welded message dialogs initially:
    
        commit 1ace888823443b85d4a81b94656844f1b27e2987
        Date:   Wed Dec 20 19:13:50 2023 +0530
    
            tdf#130857 Use native qt widgets - simple message dialog
    
    With this in place, the qt6 welded message dialog that
    shows up when opening a file that's already open in another
    instance of LO has the correct title ("Document in Use"),
    just as is the case for the non-welded one
    (whose use can be forced by setting env var
    `SAL_VCL_QT_NO_WELDED_WIDGETS=1`).
    
    Change-Id: I35f323cdfa70fb953b6bc73aaf726fb1f3098c45
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162437
    Tested-by: Jenkins
    Reviewed-by: Omkar Acharekar  <omkarachareka...@gmail.com>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtInstanceWindow.hxx b/vcl/inc/qt5/QtInstanceWindow.hxx
index be6aec6623cd..c29863da4f67 100644
--- a/vcl/inc/qt5/QtInstanceWindow.hxx
+++ b/vcl/inc/qt5/QtInstanceWindow.hxx
@@ -13,7 +13,12 @@
 
 class QtInstanceWindow : public QtInstanceContainer, public virtual 
weld::Window
 {
-    virtual void set_title(const OUString&) override;
+    QWidget* m_pWidget;
+
+public:
+    QtInstanceWindow(QWidget* pWidget);
+
+    virtual void set_title(const OUString& rTitle) override;
     virtual OUString get_title() const override;
     virtual void window_move(int, int) override;
     virtual void set_modal(bool) override;
diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx
index 8d884688e247..e65e4b749e13 100644
--- a/vcl/qt5/QtInstanceDialog.cxx
+++ b/vcl/qt5/QtInstanceDialog.cxx
@@ -10,7 +10,8 @@
 #include <QtInstanceDialog.hxx>
 
 QtInstanceDialog::QtInstanceDialog(QDialog* pDialog)
-    : m_pDialog(pDialog)
+    : QtInstanceWindow(pDialog)
+    , m_pDialog(pDialog)
 {
 }
 
diff --git a/vcl/qt5/QtInstanceWindow.cxx b/vcl/qt5/QtInstanceWindow.cxx
index e0bf4bfdd2af..0e74c8d6f873 100644
--- a/vcl/qt5/QtInstanceWindow.cxx
+++ b/vcl/qt5/QtInstanceWindow.cxx
@@ -9,9 +9,18 @@
 
 #include <QtInstanceWindow.hxx>
 
-void QtInstanceWindow::set_title(const OUString&) {}
+QtInstanceWindow::QtInstanceWindow(QWidget* pWidget)
+    : m_pWidget(pWidget)
+{
+    assert(m_pWidget);
+}
+
+void QtInstanceWindow::set_title(const OUString& rTitle)
+{
+    m_pWidget->setWindowTitle(toQString(rTitle));
+}
 
-OUString QtInstanceWindow::get_title() const { return OUString(); }
+OUString QtInstanceWindow::get_title() const { return 
toOUString(m_pWidget->windowTitle()); }
 
 void QtInstanceWindow::window_move(int, int) {}
 
commit 8efcb80c95ab173a3931da3b35fc1b5bf1e4e0d2
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 23 13:43:48 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 24 17:14:29 2024 +0100

    qt weld: Make QtInstanceDialog::m_pDialog private
    
    Change-Id: I757849beb06d0ce986be352feb34af463430333b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162436
    Tested-by: Jenkins
    Reviewed-by: Omkar Acharekar  <omkarachareka...@gmail.com>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtInstanceDialog.hxx b/vcl/inc/qt5/QtInstanceDialog.hxx
index 1eb7e5f63eb5..04b45d57a31f 100644
--- a/vcl/inc/qt5/QtInstanceDialog.hxx
+++ b/vcl/inc/qt5/QtInstanceDialog.hxx
@@ -13,9 +13,9 @@
 
 class QtInstanceDialog : public QtInstanceWindow, public virtual weld::Dialog
 {
-public:
     std::unique_ptr<QDialog> m_pDialog;
 
+public:
     QtInstanceDialog(QDialog* pDialog);
 
     virtual bool runAsync(std::shared_ptr<Dialog> const&,
@@ -48,4 +48,4 @@ public:
     virtual weld::Container* weld_content_area() override;
 };
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to