vcl/qt5/QtInstanceTreeView.cxx |   23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

New commits:
commit cf8e8f4912afaa8af95e217b076936797b8fc74a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 5 13:01:07 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 6 07:15:53 2025 +0200

    tdf#130857 qt weld: Implement QtInstanceTreeView::iter_next
    
    This will e.g. be used by the "Tools" -> "AutoCorrect"
    -> "AutoCorrect Options" dialog.
    
    Change-Id: I22a1d2f894a4edb4d1c881ebe74c6176a581bf64
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188947
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx
index db0eb0adb64d..a88f009582d3 100644
--- a/vcl/qt5/QtInstanceTreeView.cxx
+++ b/vcl/qt5/QtInstanceTreeView.cxx
@@ -399,9 +399,28 @@ bool 
QtInstanceTreeView::iter_previous_sibling(weld::TreeIter& rIter) const
     return aSiblingIndex.isValid();
 }
 
-bool QtInstanceTreeView::iter_next(weld::TreeIter&) const
+bool QtInstanceTreeView::iter_next(weld::TreeIter& rIter) const
 {
-    assert(false && "Not implemented yet");
+    QtInstanceTreeIter& rQtIter = static_cast<QtInstanceTreeIter&>(rIter);
+    QModelIndex aIndex = rQtIter.modelIndex();
+    if (m_pModel->hasChildren(aIndex))
+    {
+        rQtIter.setModelIndex(modelIndex(0, 0, aIndex));
+        return true;
+    }
+
+    while (aIndex.isValid())
+    {
+        const QModelIndex aSiblingIndex = m_pModel->sibling(aIndex.row() + 1, 
0, aIndex);
+        if (aSiblingIndex.isValid())
+        {
+            rQtIter.setModelIndex(aSiblingIndex);
+            return true;
+        }
+
+        aIndex = aIndex.parent();
+    }
+
     return false;
 }
 

Reply via email to