cui/source/inc/linkdlg.hxx | 1 + include/vcl/weld/weldutils.hxx | 3 ++- svx/source/tbxctrls/tbcontrl.cxx | 1 + vcl/inc/qt5/QtInstanceIconView.hxx | 2 -- vcl/inc/qt5/QtInstanceItemView.hxx | 2 ++ vcl/inc/qt5/QtInstanceTreeView.hxx | 1 - vcl/qt5/QtInstanceIconView.cxx | 5 ----- vcl/qt5/QtInstanceItemView.cxx | 15 +++++++++++++++ vcl/qt5/QtInstanceTreeView.cxx | 15 --------------- vcl/source/weld/weldutils.cxx | 1 + 10 files changed, 22 insertions(+), 24 deletions(-)
New commits: commit e1f08a2a3eb3975a74cabad543632f6310856b29 Author: Michael Weghorn <[email protected]> AuthorDate: Sat Dec 20 16:56:33 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Dec 20 22:32:04 2025 +0100 tdf#130857 qt weld: Move selected_foreach to QtInstanceItemView Following Change-Id: Ie16cb3222e78f53159deff74d146588429f232d6 Author: Michael Weghorn <[email protected]> Date: Sat Dec 20 16:27:54 2025 +0100 weld: Move selected_foreach to weld::ItemView , also move the QtInstanceTreeView implementation to the QtInstanceItemView base class, so it can be reused for QtInstanceIconView. Change-Id: I915dd8f889629ad0b1e08326a6e0f87f8604f61c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196033 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/qt5/QtInstanceIconView.hxx b/vcl/inc/qt5/QtInstanceIconView.hxx index 0f3607f2acc9..96bb69dee8b2 100644 --- a/vcl/inc/qt5/QtInstanceIconView.hxx +++ b/vcl/inc/qt5/QtInstanceIconView.hxx @@ -49,8 +49,6 @@ public: virtual OUString get_text(const weld::TreeIter& rIter) const override; virtual void do_scroll_to_item(const weld::TreeIter& rIter) override; - virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override; - virtual int n_children() const override; protected: diff --git a/vcl/inc/qt5/QtInstanceItemView.hxx b/vcl/inc/qt5/QtInstanceItemView.hxx index 37857733c9b1..5c0580b89b7f 100644 --- a/vcl/inc/qt5/QtInstanceItemView.hxx +++ b/vcl/inc/qt5/QtInstanceItemView.hxx @@ -64,6 +64,8 @@ public: virtual bool get_cursor(weld::TreeIter* pIter) const override; + virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override; + protected: QModelIndex modelIndex(int nRow, int nCol = 0, const QModelIndex& rParentIndex = QModelIndex()) const; diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx b/vcl/inc/qt5/QtInstanceTreeView.hxx index 6e12506f0f04..0f2ba053b8fc 100644 --- a/vcl/inc/qt5/QtInstanceTreeView.hxx +++ b/vcl/inc/qt5/QtInstanceTreeView.hxx @@ -115,7 +115,6 @@ public: int nIndexInNewParent) override; virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override; - virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override; virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& func) override; virtual void bulk_insert_for_each( int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func, diff --git a/vcl/qt5/QtInstanceIconView.cxx b/vcl/qt5/QtInstanceIconView.cxx index 9a35ff3741c4..433380d7b372 100644 --- a/vcl/qt5/QtInstanceIconView.cxx +++ b/vcl/qt5/QtInstanceIconView.cxx @@ -181,11 +181,6 @@ void QtInstanceIconView::do_scroll_to_item(const weld::TreeIter& rIter) GetQtInstance().RunInMainThread([&] { m_pListView->scrollTo(modelIndex(rIter)); }); } -void QtInstanceIconView::selected_foreach(const std::function<bool(weld::TreeIter&)>&) -{ - assert(false && "Not implemented yet"); -} - int QtInstanceIconView::n_children() const { SolarMutexGuard g; diff --git a/vcl/qt5/QtInstanceItemView.cxx b/vcl/qt5/QtInstanceItemView.cxx index 529d2c3587ad..38da98a76812 100644 --- a/vcl/qt5/QtInstanceItemView.cxx +++ b/vcl/qt5/QtInstanceItemView.cxx @@ -151,6 +151,21 @@ bool QtInstanceItemView::get_cursor(weld::TreeIter* pIter) const return bRet; } +void QtInstanceItemView::selected_foreach(const std::function<bool(weld::TreeIter&)>& func) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + QModelIndexList aSelectionIndexes = getSelectionModel().selectedRows(); + for (QModelIndex& aIndex : aSelectionIndexes) + { + QtInstanceTreeIter aIter(aIndex); + if (func(aIter)) + return; + } + }); +} + void QtInstanceItemView::do_set_cursor(const weld::TreeIter& rIter) { SolarMutexGuard g; diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index 653bcbe7e564..1872ba5c655e 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -559,21 +559,6 @@ void QtInstanceTreeView::all_foreach(const std::function<bool(weld::TreeIter&)>& } } -void QtInstanceTreeView::selected_foreach(const std::function<bool(weld::TreeIter&)>& func) -{ - 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&)>&) { assert(false && "Not implemented yet"); commit 3fa7c4dd6bc8375c397403f8925e4b2b9b76a34a Author: Michael Weghorn <[email protected]> AuthorDate: Sat Dec 20 16:40:01 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Dec 20 22:31:55 2025 +0100 weld: Forward-declare weld::TreeView in weldutils.hxx weldutils.hxx is quite widely used. Forward-declare weld::TreeView instead of including its header, to limit what needs to be recompiled when the TreeView header changes. Add necessary includes in 2 places that previously worked due to the transitive include. Change-Id: I165ea711a9953eb81dea24e3ff62e1105666218a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196011 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx index 61182113160b..a419349203a2 100644 --- a/cui/source/inc/linkdlg.hxx +++ b/cui/source/inc/linkdlg.hxx @@ -21,6 +21,7 @@ #include <vcl/idle.hxx> #include <vcl/virdev.hxx> +#include <vcl/weld/TreeView.hxx> #include <vcl/weld/DialogController.hxx> #include <vcl/weld/weld.hxx> diff --git a/include/vcl/weld/weldutils.hxx b/include/vcl/weld/weldutils.hxx index fed2f172c069..de7d0d006567 100644 --- a/include/vcl/weld/weldutils.hxx +++ b/include/vcl/weld/weldutils.hxx @@ -22,7 +22,6 @@ #include <vcl/timer.hxx> #include <vcl/transfer.hxx> #include <vcl/weld/Builder.hxx> -#include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> class CalendarWrapper; @@ -34,6 +33,8 @@ class Window; namespace weld { +class TreeView; + typedef comphelper::WeakComponentImplHelper<css::awt::XWindow> TransportAsXWindow_Base; class VCL_DLLPUBLIC TransportAsXWindow : public TransportAsXWindow_Base diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index e9245160e96d..5d2eba20a149 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -31,6 +31,7 @@ #include <vcl/event.hxx> #include <vcl/toolbox.hxx> #include <vcl/vclptr.hxx> +#include <vcl/weld/TreeView.hxx> #include <vcl/weld/customweld.hxx> #include <vcl/weld/weldutils.hxx> #include <svtools/valueset.hxx> diff --git a/vcl/source/weld/weldutils.cxx b/vcl/source/weld/weldutils.cxx index 8582be759125..7a6208d079ea 100644 --- a/vcl/source/weld/weldutils.cxx +++ b/vcl/source/weld/weldutils.cxx @@ -20,6 +20,7 @@ #include <vcl/toolkit/floatwin.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld/TreeView.hxx> #include <vcl/weld/weldutils.hxx> BuilderPage::BuilderPage(weld::Widget* pParent, weld::DialogController* pController,
