include/vcl/builder.hxx             |    2 +-
 include/vcl/builderbase.hxx         |    2 +-
 vcl/inc/qt5/QtBuilder.hxx           |    2 +-
 vcl/inc/qt5/QtInstanceAssistant.hxx |    2 ++
 vcl/qt5/QtBuilder.cxx               |    4 ++--
 vcl/qt5/QtInstanceAssistant.cxx     |   20 +++++++++++++++++---
 vcl/source/window/builder.cxx       |    4 ++--
 7 files changed, 26 insertions(+), 10 deletions(-)

New commits:
commit 5c94c294299a1c21462b55c5983f22f94f33e029
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Feb 22 22:46:15 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Feb 23 10:15:38 2025 +0100

    tdf#130857 qt weld: Implement QtInstanceAssistant::append_page
    
    Do like SalInstanceAssistant and GtkInstanceAssistant
    and have a std::vector of std::unique_ptr of the already
    created pages as a class member, so they will be deleted
    with the QtInstanceAssistant object.
    
    Change-Id: I8ad2b07ee64edd3f6018b5623be20e13b1700059
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182046
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtInstanceAssistant.hxx 
b/vcl/inc/qt5/QtInstanceAssistant.hxx
index d69108c5e5ef..199d6415c5c0 100644
--- a/vcl/inc/qt5/QtInstanceAssistant.hxx
+++ b/vcl/inc/qt5/QtInstanceAssistant.hxx
@@ -21,6 +21,8 @@ class QtInstanceAssistant : public QtInstanceDialog, public 
virtual weld::Assist
 
     QWizard* m_pWizard;
 
+    std::vector<std::unique_ptr<QtInstanceContainer>> m_aPages;
+
 public:
     QtInstanceAssistant(QWizard* pWizard);
 
diff --git a/vcl/qt5/QtInstanceAssistant.cxx b/vcl/qt5/QtInstanceAssistant.cxx
index 8827ff07b39d..12d1a51816c2 100644
--- a/vcl/qt5/QtInstanceAssistant.cxx
+++ b/vcl/qt5/QtInstanceAssistant.cxx
@@ -144,10 +144,24 @@ void QtInstanceAssistant::set_page_sensitive(const 
OUString& rIdent, bool bSensi
     });
 }
 
-weld::Container* QtInstanceAssistant::append_page(const OUString&)
+weld::Container* QtInstanceAssistant::append_page(const OUString& rIdent)
 {
-    assert(false && "not implemented yet");
-    return nullptr;
+    SolarMutexGuard g;
+
+    weld::Container* pContainer = nullptr;
+
+    GetQtInstance().RunInMainThread([&] {
+        QWizardPage* pNewPage = new QWizardPage;
+        pNewPage->setObjectName(toQString(rIdent));
+        // ensure that QWizard page ID matches page index
+        const int nPageId = m_pWizard->pageIds().size();
+        m_pWizard->setPage(nPageId, pNewPage);
+
+        m_aPages.emplace_back(new QtInstanceContainer(pNewPage));
+        pContainer = m_aPages.back().get();
+    });
+
+    return pContainer;
 }
 
 void QtInstanceAssistant::set_page_side_help_id(const OUString&)
commit ec21ae547d2128a8c76fcc8cd05e0f6260da007c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Feb 22 21:42:05 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Feb 23 10:15:26 2025 +0100

    vcl: Switch BuilderBase::set_response param from short to int
    
    An int is used in the end anyway for all cases
    (Dialog::add_button for the VCL implementations,
    QtBuilder::set_response for the Qt implementation).
    
    Change-Id: I3011f25d465edaed23ab1a312c6a424ee2d51198
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182045
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index b69290ba41e9..b93a6da1607c 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -278,7 +278,7 @@ private:
     static vcl::Window* prepareWidgetOwnScrolling(vcl::Window *pParent, 
WinBits &rWinStyle);
     void        cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, 
vcl::Window *pWindow, stringmap &rMap);
 
-    void set_response(std::u16string_view sID, short nResponse) override;
+    void set_response(std::u16string_view sID, int nResponse) override;
 
     OUString        get_by_window(const vcl::Window *pWindow) const;
     void            delete_by_window(vcl::Window *pWindow);
diff --git a/include/vcl/builderbase.hxx b/include/vcl/builderbase.hxx
index 50f416395c50..78db3d4b556b 100644
--- a/include/vcl/builderbase.hxx
+++ b/include/vcl/builderbase.hxx
@@ -137,7 +137,7 @@ protected:
 
     const ListStore* get_model_by_name(const OUString& sID) const;
 
-    virtual void set_response(std::u16string_view sID, short nResponse) = 0;
+    virtual void set_response(std::u16string_view sID, int nResponse) = 0;
 
     void handleSizeGroup(xmlreader::XmlReader& reader);
 
diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx
index c9434ddcff47..c06235686820 100644
--- a/vcl/inc/qt5/QtBuilder.hxx
+++ b/vcl/inc/qt5/QtBuilder.hxx
@@ -91,7 +91,7 @@ public:
                                   const OUString& rID, stringmap& rProps, 
stringmap& rAtkProps,
                                   accelmap& rAccels) override;
 
-    virtual void set_response(std::u16string_view sID, short nResponse) 
override;
+    virtual void set_response(std::u16string_view sID, int nResponse) override;
 
 private:
     static void deleteObject(QObject* pObject);
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 079b7988e083..476b7b942715 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -709,11 +709,11 @@ void QtBuilder::applyTabChildProperties(QObject* pParent, 
const std::vector<OUSt
                                          rProperties.at(u"label"_ustr));
 }
 
-void QtBuilder::set_response(std::u16string_view sID, short nResponse)
+void QtBuilder::set_response(std::u16string_view sID, int nResponse)
 {
     QPushButton* pPushButton = get<QPushButton>(sID);
     assert(pPushButton);
-    
pPushButton->setProperty(QtInstanceMessageDialog::PROPERTY_VCL_RESPONSE_CODE, 
int(nResponse));
+    
pPushButton->setProperty(QtInstanceMessageDialog::PROPERTY_VCL_RESPONSE_CODE, 
nResponse);
 }
 
 void QtBuilder::deleteObject(QObject* pObject)
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 19c0124bff02..fd2821d1d7ca 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3502,7 +3502,7 @@ void BuilderBase::handleActionWidget(xmlreader::XmlReader 
&reader)
     if (nDelim != -1)
         sID = sID.copy(0, nDelim);
 
-    short nResponse = sResponse.toInt32();
+    int nResponse = sResponse.toInt32();
     switch (nResponse)
     {
         case -5:
@@ -3614,7 +3614,7 @@ vcl::Window *VclBuilder::get_by_name(std::u16string_view 
sID)
     return nullptr;
 }
 
-void VclBuilder::set_response(std::u16string_view sID, short nResponse)
+void VclBuilder::set_response(std::u16string_view sID, int nResponse)
 {
     PushButton* pPushButton = get<PushButton>(sID);
     assert(pPushButton);

Reply via email to