vcl/inc/qt5/QtInstanceTreeIter.hxx |    5 ++++-
 vcl/qt5/QtInstanceTreeView.cxx     |    8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit ee1868536701873dd3a8946c33dce51941b4f6f0
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Feb 13 10:44:24 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Feb 13 19:43:44 2025 +0100

    tdf#130857 qt weld: Make QtInstanceTreeIter::m_aModelIndex private
    
    Add a getter instead of accessing the member directly
    from outside.
    
    Change-Id: Ia11451b8d838b221ebe5ef9451256de64f3fb803
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181609
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtInstanceTreeIter.hxx 
b/vcl/inc/qt5/QtInstanceTreeIter.hxx
index c91a3e41f499..857619132282 100644
--- a/vcl/inc/qt5/QtInstanceTreeIter.hxx
+++ b/vcl/inc/qt5/QtInstanceTreeIter.hxx
@@ -12,12 +12,15 @@
 #include <QtGui/QStandardItemModel>
 #include <vcl/weld.hxx>
 
-struct QtInstanceTreeIter final : public weld::TreeIter
+class QtInstanceTreeIter final : public weld::TreeIter
 {
     QModelIndex m_aModelIndex;
 
+public:
     explicit QtInstanceTreeIter(QModelIndex aModelIndex);
     virtual bool equal(const TreeIter& rOther) const override;
+
+    QModelIndex modelIndex() const { return m_aModelIndex; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx
index 857e63455ab3..1d451d1b0690 100644
--- a/vcl/qt5/QtInstanceTreeView.cxx
+++ b/vcl/qt5/QtInstanceTreeView.cxx
@@ -65,7 +65,7 @@ void QtInstanceTreeView::insert(const weld::TreeIter* 
pParent, int nPos, const O
         m_pModel->insertRow(nPos, pItem);
 
         if (pRet)
-            static_cast<QtInstanceTreeIter*>(pRet)->m_aModelIndex = 
modelIndex(nPos);
+            static_cast<QtInstanceTreeIter*>(pRet)->modelIndex() = 
modelIndex(nPos);
     });
 }
 
@@ -381,7 +381,7 @@ std::unique_ptr<weld::TreeIter> 
QtInstanceTreeView::make_iterator(const weld::Tr
 
 void QtInstanceTreeView::copy_iterator(const weld::TreeIter& rSource, 
weld::TreeIter& rDest) const
 {
-    static_cast<QtInstanceTreeIter&>(rDest).m_aModelIndex = 
modelIndex(rSource);
+    static_cast<QtInstanceTreeIter&>(rDest).modelIndex() = modelIndex(rSource);
 }
 
 bool QtInstanceTreeView::get_selected(weld::TreeIter* pIter) const
@@ -396,7 +396,7 @@ bool QtInstanceTreeView::get_selected(weld::TreeIter* 
pIter) const
 
         bHasSelection = true;
         if (pIter)
-            static_cast<QtInstanceTreeIter*>(pIter)->m_aModelIndex = 
aSelectedIndexes.first();
+            static_cast<QtInstanceTreeIter*>(pIter)->modelIndex() = 
aSelectedIndexes.first();
     });
     return bHasSelection;
 }
@@ -863,7 +863,7 @@ QModelIndex QtInstanceTreeView::modelIndex(const 
weld::TreeIter& rIter, int nCol
 
 int QtInstanceTreeView::rowIndex(const weld::TreeIter& rIter)
 {
-    QModelIndex aModelIndex = static_cast<const 
QtInstanceTreeIter&>(rIter).m_aModelIndex;
+    QModelIndex aModelIndex = static_cast<const 
QtInstanceTreeIter&>(rIter).modelIndex();
     return aModelIndex.row();
 }
 

Reply via email to