From 254743e93f67fb6d623b659b33a8c78387f23a1a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 7 Dec 2024 23:29:44 +0100 Subject: [PATCH] tdf#130857 qt weld: Implement QtInstanceTreeView::remove Side note: In Writer's "Tool" > "XML Filter Settings" dialog, trying to always delete the first entry works 3 times (when using a fresh profile), but doing it again after then doesn't remove the entry from the treeview, but the entry is still gone when closing and reopening the dialog. That's the same with gtk3 however, weld::TreeView::remove doesn't get called. So it's not a problem in the weld::TreeView implementations, but probably in XMLFilterSettingsDialog or some other underlying logic. Change-Id: Ic91b3d1d62b66574b9e0710b17b2d9606d27a0fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178068 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/inc/qt5/QtInstanceTreeView.hxx | 2 +- vcl/qt5/QtInstanceTreeView.cxx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx b/vcl/inc/qt5/QtInstanceTreeView.hxx index 110bc09c8bd2..a57734ed9079 100644 --- a/vcl/inc/qt5/QtInstanceTreeView.hxx +++ b/vcl/inc/qt5/QtInstanceTreeView.hxx @@ -42,7 +42,7 @@ public: virtual int get_selected_index() const override; virtual void select(int nPos) override; virtual void unselect(int nPos) override; - virtual void remove(int pos) override; + virtual void remove(int nPos) override; virtual OUString get_text(int nRow, int nCol = -1) const override; virtual void set_text(int nRow, const OUString& rText, int nCol = -1) override; virtual void set_sensitive(int row, bool bSensitive, int col = -1) override; diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index 34bf6dee0c13..613987c44a80 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -142,7 +142,12 @@ void QtInstanceTreeView::unselect(int nPos) }); } -void QtInstanceTreeView::remove(int) { assert(false && "Not implemented yet"); } +void QtInstanceTreeView::remove(int nPos) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { m_pModel->removeRow(nPos); }); +} OUString QtInstanceTreeView::get_text(int nRow, int nCol) const {