/** * @RDE_HEADER@ * Microsoft does strange things. * $Id: participant_edit_model.h 52287 2020-10-08 11:54:01Z biedziak_f $ * $HeadURL: svn://192.168.133.21/TDS/branches/product/features/commaster/Lts/Plugins/ParticipantManagement/Gui/Common/participant_edit_model.h $ * $Author: biedziak_f $ * Created by Mike Lennart Wille, SLTE, 2023-07-14 */ #include #include #include #include namespace ParticipantManagement { /* * Column widths are adjusted to the displayed content. Keeps all items expanded * after identifying the optimal column width if 'keepExpanded' is true. */ void beautifyTreeView(QTreeView *tv, QAbstractItemModel *pModel, bool keepExpanded) { tv->expandAll(); int colCount = pModel->columnCount(QModelIndex()); for (int i = 0; i < colCount; ++i) tv->resizeColumnToContents(i); tv->header()->resizeSection(0, tv->columnWidth(0) + tv->iconSize().width() + 10); if (!keepExpanded) tv->collapseAll(); } } // namespace ParticipantManagement