vcl/qt5/QtInstanceTreeView.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
New commits: commit 495e38c85396f9116d8f2831fc925404bf933905 Author: Michael Weghorn <[email protected]> AuthorDate: Sun Dec 8 01:17:53 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sun Dec 8 09:56:19 2024 +0100 tdf#130857 qt weld: Implement QtInstanceTreeView::selected_foreach This gets used in the "Tools" -> "XML Filter Settings" dialog in Writer when selecting multiple rows in the tree view, then clicking the "Save as Package" button. The result with SAL_VCL_QT_USE_WELDED_WIDGETS=1 and the qt6 VCL plugin in XMLFilterSettingsDialog::onSave looks as expected with this change in place (variables `aFilters` and `nFilters` contain the selected filters and total count of these when observed with a breakpoint after the call to `m_xFilterListBox->selected_foreach`). The method still triggers an assert later in a WIP branch where support for that dialog is declared, because `QtInstanceWindow::GetXWindow` is called, but not implemented yet. Change-Id: Iab47f391106132b5a6ee03fd2ad1902d493c0999 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178070 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index 581ad70c37df..6223377e2be9 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -562,9 +562,19 @@ void QtInstanceTreeView::all_foreach(const std::function<bool(weld::TreeIter&)>& assert(false && "Not implemented yet"); } -void QtInstanceTreeView::selected_foreach(const std::function<bool(weld::TreeIter&)>&) +void QtInstanceTreeView::selected_foreach(const std::function<bool(weld::TreeIter&)>& func) { - assert(false && "Not implemented yet"); + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + QModelIndexList aSelectionIndexes = m_pSelectionModel->selectedRows(); + for (QModelIndex& aIndex : aSelectionIndexes) + { + QtInstanceTreeIter aIter(aIndex); + if (func(aIter)) + return; + } + }); } void QtInstanceTreeView::visible_foreach(const std::function<bool(weld::TreeIter&)>&)
