vcl/inc/qt5/QtInstanceTreeIter.hxx |    1 +
 vcl/qt5/QtInstanceTreeView.cxx     |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 41ab24cecd6ad74312843f113d2faa13259cdb7d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Feb 13 21:58:08 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Feb 13 23:41:28 2025 +0100

    tdf#130857 qt weld: Set model index in tree iter again
    
    This went wrong in
    
        commit ee1868536701873dd3a8946c33dce51941b4f6f0
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu Feb 13 10:44:24 2025 +0100
    
            tdf#130857 qt weld: Make QtInstanceTreeIter::m_aModelIndex private
    
    Change-Id: I2c140c2775d185c5b79ec9cacad45d12114ddcf8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181652
    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 857619132282..647560611645 100644
--- a/vcl/inc/qt5/QtInstanceTreeIter.hxx
+++ b/vcl/inc/qt5/QtInstanceTreeIter.hxx
@@ -21,6 +21,7 @@ public:
     virtual bool equal(const TreeIter& rOther) const override;
 
     QModelIndex modelIndex() const { return m_aModelIndex; }
+    void setModelIndex(const QModelIndex& aIndex) { m_aModelIndex = aIndex; }
 };
 
 /* 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 1d451d1b0690..a904a8400e73 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)->modelIndex() = 
modelIndex(nPos);
+            
static_cast<QtInstanceTreeIter*>(pRet)->setModelIndex(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).modelIndex() = modelIndex(rSource);
+    static_cast<QtInstanceTreeIter&>(rDest).setModelIndex(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)->modelIndex() = 
aSelectedIndexes.first();
+            
static_cast<QtInstanceTreeIter*>(pIter)->setModelIndex(aSelectedIndexes.first());
     });
     return bHasSelection;
 }

Reply via email to