vcl/qt5/QtInstanceTreeView.cxx |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 2f1c88e4d9f0d1e069dd36bacc7c78060086d147
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Aug 13 11:18:12 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Wed Aug 13 21:47:59 2025 +0200

    tdf#130857 qt weld: Implement QtInstanceTreeView::get_cursor
    
    This will be used e.g. by the Calc autofilter dropdown
    (see ScCheckListMenuControl::ButtonHdl) once support for
    it is declared.
    
    Change-Id: I6a7a5c2b2f554440f7e15be53f62b72bfff00206
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189505
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx
index 0ba4934380b3..3a767595546e 100644
--- a/vcl/qt5/QtInstanceTreeView.cxx
+++ b/vcl/qt5/QtInstanceTreeView.cxx
@@ -356,10 +356,20 @@ bool QtInstanceTreeView::get_selected(weld::TreeIter* 
pIter) const
     return bHasSelection;
 }
 
-bool QtInstanceTreeView::get_cursor(weld::TreeIter*) const
+bool QtInstanceTreeView::get_cursor(weld::TreeIter* pIter) const
 {
-    assert(false && "Not implemented yet");
-    return false;
+    SolarMutexGuard g;
+
+    bool bRet = false;
+    GetQtInstance().RunInMainThread([&] {
+        const QModelIndex aCurrentIndex = m_pTreeView->currentIndex();
+        QtInstanceTreeIter* pQtIter = static_cast<QtInstanceTreeIter*>(pIter);
+        if (pQtIter)
+            pQtIter->setModelIndex(aCurrentIndex);
+        bRet = aCurrentIndex.isValid();
+    });
+
+    return bRet;
 }
 
 void QtInstanceTreeView::set_cursor(const weld::TreeIter& rIter)

Reply via email to