vcl/CustomTarget_qt5_moc.mk           |    1 +
 vcl/CustomTarget_qt6_moc.mk           |    1 +
 vcl/inc/qt5/QtInstanceCheckButton.hxx |    6 +++++-
 vcl/inc/qt5/QtInstanceDialog.hxx      |    1 +
 vcl/qt5/QtInstanceCheckButton.cxx     |    2 ++
 vcl/qt5/QtInstanceDialog.cxx          |   19 +++++++++++++++++--
 vcl/qt5/QtInstanceNotebook.cxx        |    3 +++
 7 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 3e65d085efa2f2d2a8a51e57b752a8ffb2e7624d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Nov 23 00:57:37 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Nov 23 10:49:05 2024 +0100

    tdf#130857 qt weld: Call checkbox toggled handler
    
    Change-Id: I0943a2d8e35acea8e1af97bdd151bba65b0af24a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177056
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index efa4fd9e16fd..a819d4008307 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -14,6 +14,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtFilePicker.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtFrame.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceCheckButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceComboBox.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceContainer.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDialog.moc \
diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk
index 69fc48db7ae5..cb53e819835e 100644
--- a/vcl/CustomTarget_qt6_moc.mk
+++ b/vcl/CustomTarget_qt6_moc.mk
@@ -14,6 +14,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtFilePicker.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtFrame.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceCheckButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceComboBox.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceContainer.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDialog.moc \
diff --git a/vcl/inc/qt5/QtInstanceCheckButton.hxx 
b/vcl/inc/qt5/QtInstanceCheckButton.hxx
index 43db65c96a72..a13c883ac310 100644
--- a/vcl/inc/qt5/QtInstanceCheckButton.hxx
+++ b/vcl/inc/qt5/QtInstanceCheckButton.hxx
@@ -14,8 +14,12 @@
 #include <QtCore/QObject>
 #include <QtWidgets/QCheckBox>
 
-class QtInstanceCheckButton : public QtInstanceWidget, public virtual 
weld::CheckButton
+class QtInstanceCheckButton : public QObject,
+                              public QtInstanceWidget,
+                              public virtual weld::CheckButton
 {
+    Q_OBJECT
+
     QCheckBox* m_pCheckBox;
 
 public:
diff --git a/vcl/qt5/QtInstanceCheckButton.cxx 
b/vcl/qt5/QtInstanceCheckButton.cxx
index f4590d393444..835dcd356196 100644
--- a/vcl/qt5/QtInstanceCheckButton.cxx
+++ b/vcl/qt5/QtInstanceCheckButton.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <QtInstanceCheckButton.hxx>
+#include <QtInstanceCheckButton.moc>
 
 #include <vcl/qt/QtUtils.hxx>
 
@@ -16,6 +17,7 @@ QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox* 
pCheckBox)
     , m_pCheckBox(pCheckBox)
 {
     assert(m_pCheckBox);
+    connect(m_pCheckBox, &QCheckBox::toggled, this, [&] { signal_toggled(); });
 }
 
 void QtInstanceCheckButton::set_active(bool bActive)
commit f928b97cfa9ab335a6be75bd993f335cfd666673
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Nov 23 00:16:53 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Nov 23 10:48:59 2024 +0100

    tdf#130857 qt weld: Handle invalid ID in QtInstanceNotebook::get_page
    
    If QtInstanceNotebook::get_page gets called with
    and ID that none of the existing pages actually have,
    return nullptr early and don't try to QtInstanceContainer
    instance for the null widget, which would trigger an
    assert when nullptr is passed to the QtInstanceWidget
    base class ctor.
    
    Calling QtInstanceNotebook::get_page with an ID for
    which no page exists yet is what
    SfxTabDialogController::AddTabPage does explicitly
    before asserting a page to assert that there isn't
    such a page yet.
    
    SalInstanceNotebook::get_page and GtkInstanceNotebook
    also have specific handling for that case.
    
    Change-Id: Ib2044fd4c9f986f2252afed5754a6383f940e5e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177055
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceNotebook.cxx b/vcl/qt5/QtInstanceNotebook.cxx
index 6c28ce5c87e4..c8da18d5f5d6 100644
--- a/vcl/qt5/QtInstanceNotebook.cxx
+++ b/vcl/qt5/QtInstanceNotebook.cxx
@@ -155,6 +155,9 @@ weld::Container* QtInstanceNotebook::get_page(const 
OUString& rIdent) const
         pWidget = m_pTabWidget->widget(nIndex);
     });
 
+    if (!pWidget)
+        return nullptr;
+
     if (!m_aPageContainerInstances.contains(pWidget))
         m_aPageContainerInstances.emplace(pWidget, 
std::make_unique<QtInstanceContainer>(pWidget));
 
commit f3bacd7b2ae909d39916eb9a31dd1b4994118d8f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Nov 22 23:39:27 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Nov 23 10:48:52 2024 +0100

    tdf#130857 qt weld: Implement QtInstanceDialog::weld_content_area
    
    When this method gets called the first time, insert
    a widget with a QVBoxLayout at the beginning
    of the dialog's layout, remember and return that.
    On subsequent call, return the same one.
    
    Initially, handle the case where the dialog's
    layout is a QBoxLayout (subclass), which is
    the case for the "File" -> "Printer Settings"
    -> "Options" dialog in Writer.
    
    This should be easy to extend for other layouts
    as well when needed. For now, assert when another
    layout is used, so it will become clear when
    working on adding support for another dialog
    that needs this.
    
    Change-Id: Ia41a87f8cf62666efc91c05f25dae5fccb3da41d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177054
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtInstanceDialog.hxx b/vcl/inc/qt5/QtInstanceDialog.hxx
index e47849cc9bd7..5c8a6d0981ab 100644
--- a/vcl/inc/qt5/QtInstanceDialog.hxx
+++ b/vcl/inc/qt5/QtInstanceDialog.hxx
@@ -18,6 +18,7 @@ class QtInstanceDialog : public QtInstanceWindow, public 
virtual weld::Dialog
     Q_OBJECT
 
     std::unique_ptr<QDialog> m_pDialog;
+    QWidget* m_pContentArea;
 
     // the DialogController/Dialog/function passed to the runAsync variants
     std::shared_ptr<weld::DialogController> m_xRunAsyncDialogController;
diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx
index 7a4ca77ad70f..c1be1db313c0 100644
--- a/vcl/qt5/QtInstanceDialog.cxx
+++ b/vcl/qt5/QtInstanceDialog.cxx
@@ -19,6 +19,7 @@ const char* const 
QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE = "response-code"
 QtInstanceDialog::QtInstanceDialog(QDialog* pDialog)
     : QtInstanceWindow(pDialog)
     , m_pDialog(pDialog)
+    , m_pContentArea(nullptr)
     , m_aRunAsyncFunc(nullptr)
 {
 }
@@ -148,8 +149,22 @@ void QtInstanceDialog::set_default_response(int) { 
assert(false && "Not implemen
 
 std::unique_ptr<weld::Container> QtInstanceDialog::weld_content_area()
 {
-    assert(false && "Not implemented yet");
-    return nullptr;
+    if (!m_pContentArea)
+    {
+        if (QBoxLayout* pBoxLayout = 
qobject_cast<QBoxLayout*>(m_pDialog->layout()))
+        {
+            // insert an extra widget and layout at beginning of the dialog's 
layout
+            m_pContentArea = new QWidget;
+            m_pContentArea->setLayout(new QVBoxLayout);
+            pBoxLayout->insertWidget(0, m_pContentArea);
+        }
+        else
+        {
+            assert(false && "Dialog has layout that's not supported (yet)");
+        }
+    }
+
+    return std::make_unique<QtInstanceContainer>(m_pContentArea);
 }
 
 void QtInstanceDialog::dialogFinished(int nResult)

Reply via email to