tdf#130857 qt weld: Implement QtInstanceTreeView::columns_autosize

QTreeView::resizeColumnToContents [1] looks like the Qt
equivalent for GTK's gtk_tree_view_columns_autosize [2].

[1] https://doc.qt.io/qt-6/qtreeview.html#resizeColumnToContents
[2] https://docs.gtk.org/gtk3/method.TreeView.columns_autosize.html

Change-Id: I4771896fb932834f51fa48ceaa3557181f474fcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178062
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2024-12-07 20:02:08 +01:00
parent 23ea73587a
commit 36ab4833c9

View file

@ -653,7 +653,15 @@ int QtInstanceTreeView::get_height_rows(int) const
return 0;
}
void QtInstanceTreeView::columns_autosize() { assert(false && "Not implemented yet"); }
void QtInstanceTreeView::columns_autosize()
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] {
for (int i = 0; i < m_pModel->columnCount(); i++)
m_pTreeView->resizeColumnToContents(i);
});
}
void QtInstanceTreeView::set_column_fixed_widths(const std::vector<int>&)
{