vcl/inc/qt5/QtInstanceTreeView.hxx | 2 ++ vcl/qt5/QtInstanceTreeView.cxx | 16 ++++++++++++++++ 2 files changed, 18 insertions(+)
New commits: commit 8d096e7c60158a6e0daa6731b555217f83c789bb Author: Michael Weghorn <[email protected]> AuthorDate: Mon Jan 12 13:19:57 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Jan 13 19:37:13 2026 +0100 tdf#130857 qt weld: Signal when TreeView item is expanded/collapsed This is necessary to support on-demand children as used e.g. in the "Tools" -> "Options" -> "Advanced" -> "Expert Configuration" dialog (that is not supported yet, but this is one step in that direction). Change-Id: I6b12876e15f17f4659d6659b1e17b1042ef82275 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197096 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx b/vcl/inc/qt5/QtInstanceTreeView.hxx index 0ff27ecfd967..d3c9451b43cb 100644 --- a/vcl/inc/qt5/QtInstanceTreeView.hxx +++ b/vcl/inc/qt5/QtInstanceTreeView.hxx @@ -182,6 +182,8 @@ private Q_SLOTS: void handleDataChanged(const QModelIndex& rTopLeft, const QModelIndex& rBottomRight, const QVector<int>& rRoles); void handleSelectionChanged(); + void signalCollapsing(const QModelIndex& rIndex); + void signalExpanding(const QModelIndex& rIndex); }; /* 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 1fe18cd213d4..7439aad32c33 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -41,6 +41,8 @@ QtInstanceTreeView::QtInstanceTreeView(QTreeView* pTreeView) &QtInstanceTreeView::handleSelectionChanged); connect(m_pModel, &QSortFilterProxyModel::dataChanged, this, &QtInstanceTreeView::handleDataChanged); + connect(m_pTreeView, &QTreeView::collapsed, this, &QtInstanceTreeView::signalCollapsing); + connect(m_pTreeView, &QTreeView::expanded, this, &QtInstanceTreeView::signalExpanding); assert(m_pTreeView->viewport()); m_pTreeView->viewport()->installEventFilter(this); @@ -865,4 +867,18 @@ void QtInstanceTreeView::handleSelectionChanged() signal_selection_changed(); } +void QtInstanceTreeView::signalCollapsing(const QModelIndex& rIndex) +{ + SolarMutexGuard g; + + signal_collapsing(QtInstanceTreeIter(rIndex)); +} + +void QtInstanceTreeView::signalExpanding(const QModelIndex& rIndex) +{ + SolarMutexGuard g; + + signal_expanding(QtInstanceTreeIter(rIndex)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
