vcl/CustomTarget_qt5_moc.mk      |    1 +
 vcl/CustomTarget_qt6_moc.mk      |    1 +
 vcl/inc/qt5/QtBuilder.hxx        |    1 +
 vcl/inc/qt5/QtHyperlinkLabel.hxx |    2 ++
 vcl/qt5/QtHyperlinkLabel.cxx     |    1 +
 5 files changed, 6 insertions(+)

New commits:
commit 46159476c32c64e2f63d0e1a7ae77deca48b5920
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Mar 10 13:00:11 2025 -0700
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Mar 11 04:52:47 2025 +0100

    tdf#130857 qt weld: Assert type before static_cast
    
    As Noel Grandin points out in [1], this can help
    "so we catch issues early and obviously (instead of getting
    some weird crash later on)".
    
    [1] https://gerrit.libreoffice.org/c/core/+/182711
    
    Change-Id: I5e8c9f9bc441f2c60d7a6b78ba52c7027d3fab7d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182752
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx
index a11a2cf429f9..5cae4374bd5e 100644
--- a/vcl/inc/qt5/QtBuilder.hxx
+++ b/vcl/inc/qt5/QtBuilder.hxx
@@ -105,6 +105,7 @@ private:
 template <typename T> inline T* QtBuilder::get(const OUString& rId)
 {
     QWidget* pWidget = get_by_name(rId);
+    assert(!pWidget || qobject_cast<T*>(pWidget));
     return static_cast<T*>(pWidget);
 }
 
commit 5d5b1c0c1bcdd313ed0ea0227b7449d65651b3b9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Mar 10 12:58:52 2025 -0700
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Mar 11 04:52:37 2025 +0100

    tdf#130857 qt weld: Add Q_OBJECT macro to QtHyperlinkLabel
    
    This is needed to `qobject_cast` to that class.
    
    This prepares for upcoming commit
    
        Change-Id: I5e8c9f9bc441f2c60d7a6b78ba52c7027d3fab7d
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Mar 10 13:00:11 2025 -0700
    
            tdf#130857 qt weld: Assert type before static_cast
    
    Change-Id: I89b930d4cacbf11ab5e85f627c0caf7aebaf61d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182751
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index 95c6b5df86da..c7a3e691535f 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -15,6 +15,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtExpander.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtFilePicker.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtFrame.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtHyperlinkLabel.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceAssistant.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceBox.moc \
diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk
index 1004e7756966..0ed358e0d8d3 100644
--- a/vcl/CustomTarget_qt6_moc.mk
+++ b/vcl/CustomTarget_qt6_moc.mk
@@ -15,6 +15,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtExpander.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtFilePicker.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtFrame.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtHyperlinkLabel.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceAssistant.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceBox.moc \
diff --git a/vcl/inc/qt5/QtHyperlinkLabel.hxx b/vcl/inc/qt5/QtHyperlinkLabel.hxx
index c7cfc7e2eee2..6de64b8b6516 100644
--- a/vcl/inc/qt5/QtHyperlinkLabel.hxx
+++ b/vcl/inc/qt5/QtHyperlinkLabel.hxx
@@ -18,6 +18,8 @@
  */
 class QtHyperlinkLabel : public QLabel
 {
+    Q_OBJECT
+
     QString m_sDisplayText;
     QString m_sUri;
 
diff --git a/vcl/qt5/QtHyperlinkLabel.cxx b/vcl/qt5/QtHyperlinkLabel.cxx
index 9743fe4e1d9c..84bdb529f245 100644
--- a/vcl/qt5/QtHyperlinkLabel.cxx
+++ b/vcl/qt5/QtHyperlinkLabel.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <QtHyperlinkLabel.hxx>
+#include <QtHyperlinkLabel.moc>
 
 QtHyperlinkLabel::QtHyperlinkLabel(QWidget* pParent)
     : QLabel(pParent)

Reply via email to