vcl/CustomTarget_qt5_moc.mk           |    4 ++++
 vcl/CustomTarget_qt6_moc.mk           |    4 ++++
 vcl/inc/qt5/QtInstanceButton.hxx      |    2 +-
 vcl/inc/qt5/QtInstanceCheckButton.hxx |    4 +---
 vcl/inc/qt5/QtInstanceComboBox.hxx    |    2 +-
 vcl/inc/qt5/QtInstanceContainer.hxx   |    2 +-
 vcl/inc/qt5/QtInstanceDrawingArea.hxx |    4 +---
 vcl/inc/qt5/QtInstanceEntry.hxx       |    2 +-
 vcl/inc/qt5/QtInstanceExpander.hxx    |    2 +-
 vcl/inc/qt5/QtInstanceImage.hxx       |    2 ++
 vcl/inc/qt5/QtInstanceLabel.hxx       |    2 ++
 vcl/inc/qt5/QtInstanceLevelBar.hxx    |    2 +-
 vcl/inc/qt5/QtInstanceLinkButton.hxx  |    4 +---
 vcl/inc/qt5/QtInstanceNotebook.hxx    |    2 +-
 vcl/inc/qt5/QtInstanceProgressBar.hxx |    4 +---
 vcl/inc/qt5/QtInstanceRadioButton.hxx |    4 +---
 vcl/inc/qt5/QtInstanceTextView.hxx    |    2 ++
 vcl/inc/qt5/QtInstanceTreeView.hxx    |    2 +-
 vcl/inc/qt5/QtInstanceWidget.hxx      |    7 +++++--
 vcl/qt5/QtInstanceImage.cxx           |    1 +
 vcl/qt5/QtInstanceLabel.cxx           |    1 +
 vcl/qt5/QtInstanceTextView.cxx        |    1 +
 vcl/qt5/QtInstanceWidget.cxx          |   25 ++++++++++++++++++++++---
 23 files changed, 57 insertions(+), 28 deletions(-)

New commits:
commit 2d0d3500c29a5e31a6e6ecf86aa7bc604a537a1c
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Dec 4 23:41:22 2024 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Dec 5 09:27:50 2024 +0100

    tdf#130857 qt weld: Let QtInstanceWidget derive from QObject
    
    Also add Q_OBJECT macros for all subclasses
    that didn't have them and run moc for them, too.
    
    Change-Id: Ia42ee7d02b68d54df308d33c88bf286468bfa68f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177833
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index 3b7c6165e5ae..6e3d7dda89fd 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -23,6 +23,8 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDrawingArea.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceEntry.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceExpander.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceImage.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLabel.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLevelBar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLinkButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceMessageDialog.moc \
@@ -30,7 +32,9 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceProgressBar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceRadioButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceSpinButton.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTextView.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTreeView.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceWidget.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtMainWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtMenu.moc \
diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk
index 63d90a3905e0..a45846b37ea5 100644
--- a/vcl/CustomTarget_qt6_moc.mk
+++ b/vcl/CustomTarget_qt6_moc.mk
@@ -23,6 +23,8 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDrawingArea.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceEntry.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceExpander.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceImage.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLabel.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLevelBar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLinkButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceMessageDialog.moc \
@@ -30,7 +32,9 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceProgressBar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceRadioButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceSpinButton.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTextView.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTreeView.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceWidget.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtMainWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtMenu.moc \
diff --git a/vcl/inc/qt5/QtInstanceButton.hxx b/vcl/inc/qt5/QtInstanceButton.hxx
index a302ba54e978..c25342e0bc83 100644
--- a/vcl/inc/qt5/QtInstanceButton.hxx
+++ b/vcl/inc/qt5/QtInstanceButton.hxx
@@ -14,7 +14,7 @@
 #include <QtCore/QObject>
 #include <QtWidgets/QPushButton>
 
-class QtInstanceButton : public QObject, public QtInstanceWidget, public 
virtual weld::Button
+class QtInstanceButton : public QtInstanceWidget, public virtual weld::Button
 {
     QPushButton* m_pButton;
 
diff --git a/vcl/inc/qt5/QtInstanceCheckButton.hxx 
b/vcl/inc/qt5/QtInstanceCheckButton.hxx
index 7a3a56137ce7..a929dfe5e465 100644
--- a/vcl/inc/qt5/QtInstanceCheckButton.hxx
+++ b/vcl/inc/qt5/QtInstanceCheckButton.hxx
@@ -14,9 +14,7 @@
 #include <QtCore/QObject>
 #include <QtWidgets/QCheckBox>
 
-class QtInstanceCheckButton : public QObject,
-                              public QtInstanceWidget,
-                              public virtual weld::CheckButton
+class QtInstanceCheckButton : public QtInstanceWidget, public virtual 
weld::CheckButton
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceComboBox.hxx 
b/vcl/inc/qt5/QtInstanceComboBox.hxx
index d21c61a3f086..15c91eb20915 100644
--- a/vcl/inc/qt5/QtInstanceComboBox.hxx
+++ b/vcl/inc/qt5/QtInstanceComboBox.hxx
@@ -13,7 +13,7 @@
 
 #include <QtWidgets/QComboBox>
 
-class QtInstanceComboBox : public QObject, public QtInstanceWidget, public 
virtual weld::ComboBox
+class QtInstanceComboBox : public QtInstanceWidget, public virtual 
weld::ComboBox
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceContainer.hxx 
b/vcl/inc/qt5/QtInstanceContainer.hxx
index dc38f2ae6e49..8fea34cd8d74 100644
--- a/vcl/inc/qt5/QtInstanceContainer.hxx
+++ b/vcl/inc/qt5/QtInstanceContainer.hxx
@@ -13,7 +13,7 @@
 
 #include <QtWidgets/QLayout>
 
-class QtInstanceContainer : public QObject, public QtInstanceWidget, public 
virtual weld::Container
+class QtInstanceContainer : public QtInstanceWidget, public virtual 
weld::Container
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceDrawingArea.hxx 
b/vcl/inc/qt5/QtInstanceDrawingArea.hxx
index 866d39bdccea..c403662ef6f9 100644
--- a/vcl/inc/qt5/QtInstanceDrawingArea.hxx
+++ b/vcl/inc/qt5/QtInstanceDrawingArea.hxx
@@ -13,9 +13,7 @@
 
 #include <QtWidgets/QLabel>
 
-class QtInstanceDrawingArea : public QObject,
-                              public QtInstanceWidget,
-                              public virtual weld::DrawingArea
+class QtInstanceDrawingArea : public QtInstanceWidget, public virtual 
weld::DrawingArea
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceEntry.hxx b/vcl/inc/qt5/QtInstanceEntry.hxx
index 987df275c31b..b7b1ef162d6a 100644
--- a/vcl/inc/qt5/QtInstanceEntry.hxx
+++ b/vcl/inc/qt5/QtInstanceEntry.hxx
@@ -13,7 +13,7 @@
 
 #include <QtWidgets/QLineEdit>
 
-class QtInstanceEntry : public QObject, public QtInstanceWidget, public 
virtual weld::Entry
+class QtInstanceEntry : public QtInstanceWidget, public virtual weld::Entry
 {
     Q_OBJECT;
 
diff --git a/vcl/inc/qt5/QtInstanceExpander.hxx 
b/vcl/inc/qt5/QtInstanceExpander.hxx
index d596acb9ba94..efafd8a7cf30 100644
--- a/vcl/inc/qt5/QtInstanceExpander.hxx
+++ b/vcl/inc/qt5/QtInstanceExpander.hxx
@@ -12,7 +12,7 @@
 #include "QtInstanceWidget.hxx"
 #include "QtExpander.hxx"
 
-class QtInstanceExpander : public QObject, public QtInstanceWidget, public 
virtual weld::Expander
+class QtInstanceExpander : public QtInstanceWidget, public virtual 
weld::Expander
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceImage.hxx b/vcl/inc/qt5/QtInstanceImage.hxx
index 4f6588d49867..ebef898bb011 100644
--- a/vcl/inc/qt5/QtInstanceImage.hxx
+++ b/vcl/inc/qt5/QtInstanceImage.hxx
@@ -15,6 +15,8 @@
 
 class QtInstanceImage : public QtInstanceWidget, public virtual weld::Image
 {
+    Q_OBJECT
+
     QLabel* m_pLabel;
 
 public:
diff --git a/vcl/inc/qt5/QtInstanceLabel.hxx b/vcl/inc/qt5/QtInstanceLabel.hxx
index 0feb6ce7ac2f..64fb09e6c399 100644
--- a/vcl/inc/qt5/QtInstanceLabel.hxx
+++ b/vcl/inc/qt5/QtInstanceLabel.hxx
@@ -16,6 +16,8 @@
 
 class QtInstanceLabel : public QtInstanceWidget, public virtual weld::Label
 {
+    Q_OBJECT
+
     QLabel* m_pLabel;
 
 public:
diff --git a/vcl/inc/qt5/QtInstanceLevelBar.hxx 
b/vcl/inc/qt5/QtInstanceLevelBar.hxx
index cb819b0da902..5d728335ae13 100644
--- a/vcl/inc/qt5/QtInstanceLevelBar.hxx
+++ b/vcl/inc/qt5/QtInstanceLevelBar.hxx
@@ -13,7 +13,7 @@
 
 #include <QtWidgets/QProgressBar>
 
-class QtInstanceLevelBar : public QObject, public QtInstanceWidget, public 
virtual weld::LevelBar
+class QtInstanceLevelBar : public QtInstanceWidget, public virtual 
weld::LevelBar
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceLinkButton.hxx 
b/vcl/inc/qt5/QtInstanceLinkButton.hxx
index 43b91344eebf..425daf13849c 100644
--- a/vcl/inc/qt5/QtInstanceLinkButton.hxx
+++ b/vcl/inc/qt5/QtInstanceLinkButton.hxx
@@ -14,9 +14,7 @@
 
 #include <QtWidgets/QLabel>
 
-class QtInstanceLinkButton : public QObject,
-                             public QtInstanceWidget,
-                             public virtual weld::LinkButton
+class QtInstanceLinkButton : public QtInstanceWidget, public virtual 
weld::LinkButton
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceNotebook.hxx 
b/vcl/inc/qt5/QtInstanceNotebook.hxx
index bf43ac39e54f..2a18a65784a0 100644
--- a/vcl/inc/qt5/QtInstanceNotebook.hxx
+++ b/vcl/inc/qt5/QtInstanceNotebook.hxx
@@ -16,7 +16,7 @@
 
 #include <map>
 
-class QtInstanceNotebook : public QObject, public QtInstanceWidget, public 
virtual weld::Notebook
+class QtInstanceNotebook : public QtInstanceWidget, public virtual 
weld::Notebook
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceProgressBar.hxx 
b/vcl/inc/qt5/QtInstanceProgressBar.hxx
index 2efe6d126ed6..9f26a5cdeb73 100644
--- a/vcl/inc/qt5/QtInstanceProgressBar.hxx
+++ b/vcl/inc/qt5/QtInstanceProgressBar.hxx
@@ -13,9 +13,7 @@
 
 #include <QtWidgets/QProgressBar>
 
-class QtInstanceProgressBar : public QObject,
-                              public QtInstanceWidget,
-                              public virtual weld::ProgressBar
+class QtInstanceProgressBar : public QtInstanceWidget, public virtual 
weld::ProgressBar
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceRadioButton.hxx 
b/vcl/inc/qt5/QtInstanceRadioButton.hxx
index 5dee84d36f01..56955c5f51d5 100644
--- a/vcl/inc/qt5/QtInstanceRadioButton.hxx
+++ b/vcl/inc/qt5/QtInstanceRadioButton.hxx
@@ -14,9 +14,7 @@
 #include <QtCore/QObject>
 #include <QtWidgets/QRadioButton>
 
-class QtInstanceRadioButton : public QObject,
-                              public QtInstanceWidget,
-                              public virtual weld::RadioButton
+class QtInstanceRadioButton : public QtInstanceWidget, public virtual 
weld::RadioButton
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceTextView.hxx 
b/vcl/inc/qt5/QtInstanceTextView.hxx
index 36dfda0d3379..4fb8ca94c6c9 100644
--- a/vcl/inc/qt5/QtInstanceTextView.hxx
+++ b/vcl/inc/qt5/QtInstanceTextView.hxx
@@ -15,6 +15,8 @@
 
 class QtInstanceTextView : public QtInstanceWidget, public virtual 
weld::TextView
 {
+    Q_OBJECT
+
     QPlainTextEdit* m_pTextEdit;
 
 public:
diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx 
b/vcl/inc/qt5/QtInstanceTreeView.hxx
index a344c365a7c4..dd252c3e2b47 100644
--- a/vcl/inc/qt5/QtInstanceTreeView.hxx
+++ b/vcl/inc/qt5/QtInstanceTreeView.hxx
@@ -14,7 +14,7 @@
 #include <QtGui/QStandardItemModel>
 #include <QtWidgets/QTreeView>
 
-class QtInstanceTreeView : public QObject, public QtInstanceWidget, public 
virtual weld::TreeView
+class QtInstanceTreeView : public QtInstanceWidget, public virtual 
weld::TreeView
 {
     Q_OBJECT
 
diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx
index f50f4de1e84a..a790ac81edf7 100644
--- a/vcl/inc/qt5/QtInstanceWidget.hxx
+++ b/vcl/inc/qt5/QtInstanceWidget.hxx
@@ -19,8 +19,10 @@
 #include <rtl/ustring.hxx>
 #include <vcl/sysdata.hxx>
 
-class QtInstanceWidget : public virtual weld::Widget
+class QtInstanceWidget : public QObject, public virtual weld::Widget
 {
+    Q_OBJECT
+
     QWidget* m_pWidget;
 
 public:
diff --git a/vcl/qt5/QtInstanceImage.cxx b/vcl/qt5/QtInstanceImage.cxx
index 291ba1be7689..1d56edea08e9 100644
--- a/vcl/qt5/QtInstanceImage.cxx
+++ b/vcl/qt5/QtInstanceImage.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <QtInstanceImage.hxx>
+#include <QtInstanceImage.moc>
 
 #include <vcl/qt/QtUtils.hxx>
 
diff --git a/vcl/qt5/QtInstanceLabel.cxx b/vcl/qt5/QtInstanceLabel.cxx
index ca12c3314e81..d498e2000e7e 100644
--- a/vcl/qt5/QtInstanceLabel.cxx
+++ b/vcl/qt5/QtInstanceLabel.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <QtInstanceLabel.hxx>
+#include <QtInstanceLabel.moc>
 
 #include <vcl/qt/QtUtils.hxx>
 
diff --git a/vcl/qt5/QtInstanceTextView.cxx b/vcl/qt5/QtInstanceTextView.cxx
index 9106ee3f2095..dc85c9850d01 100644
--- a/vcl/qt5/QtInstanceTextView.cxx
+++ b/vcl/qt5/QtInstanceTextView.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <QtInstanceTextView.hxx>
+#include <QtInstanceTextView.moc>
 
 #include <vcl/qt/QtUtils.hxx>
 
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx
index 5a770e4a479d..0ecf4ffd6d14 100644
--- a/vcl/qt5/QtInstanceWidget.cxx
+++ b/vcl/qt5/QtInstanceWidget.cxx
@@ -8,6 +8,8 @@
  */
 
 #include <QtInstanceWidget.hxx>
+#include <QtInstanceWidget.moc>
+
 #include <QtInstanceContainer.hxx>
 
 #include <vcl/transfer.hxx>
commit 44b2a3d53646bd3c55993af29121d007fb177c55
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Dec 4 23:15:41 2024 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Dec 5 09:27:39 2024 +0100

    tdf#130857 qt weld: Implement QtInstanceWidget::get_extents_relative_to
    
    This e.g. gets called when pressing the "Find Next" button
    in the "Find and Replace" dialog.
    
    Change-Id: I30e33d52d19b0afe44564486bfa79e3b500ae856
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177832
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx
index a98288908084..f50f4de1e84a 100644
--- a/vcl/inc/qt5/QtInstanceWidget.hxx
+++ b/vcl/inc/qt5/QtInstanceWidget.hxx
@@ -130,7 +130,8 @@ public:
 
     virtual void grab_remove() override;
 
-    virtual bool get_extents_relative_to(const Widget&, int&, int&, int&, 
int&) const override;
+    virtual bool get_extents_relative_to(const Widget& rRelative, int& rX, 
int& rY, int& rWidth,
+                                         int& rHeight) const override;
 
     virtual bool get_direction() const override;
 
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx
index da0c0112dab0..5a770e4a479d 100644
--- a/vcl/qt5/QtInstanceWidget.cxx
+++ b/vcl/qt5/QtInstanceWidget.cxx
@@ -459,10 +459,27 @@ bool QtInstanceWidget::has_grab() const
 
 void QtInstanceWidget::grab_remove() { assert(false && "Not implemented yet"); 
}
 
-bool QtInstanceWidget::get_extents_relative_to(const Widget&, int&, int&, 
int&, int&) const
+bool QtInstanceWidget::get_extents_relative_to(const Widget& rRelative, int& 
rX, int& rY,
+                                               int& rWidth, int& rHeight) const
 {
-    assert(false && "Not implemented yet");
-    return false;
+    SolarMutexGuard g;
+
+    bool bRet = false;
+    GetQtInstance().RunInMainThread([&] {
+        QRect aGeometry = m_pWidget->geometry();
+        rWidth = aGeometry.width();
+        rHeight = aGeometry.height();
+        const QtInstanceWidget* pRelativeWidget = dynamic_cast<const 
QtInstanceWidget*>(&rRelative);
+        if (!pRelativeWidget)
+            return;
+
+        QPoint aRelativePos = m_pWidget->mapTo(pRelativeWidget->getQWidget(), 
QPoint(0, 0));
+        rX = aRelativePos.x();
+        rY = aRelativePos.y();
+        bRet = true;
+    });
+
+    return bRet;
 }
 
 bool QtInstanceWidget::get_direction() const

Reply via email to