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 <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn 2024-12-07 23:29:44 +01:00
parent 044f2113dc
commit 254743e93f
2 changed files with 7 additions and 2 deletions

View file

@ -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;

View file

@ -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
{