QGIM: fix columnCount for tree model

If static_column_count is 0 (one_dimensional_range) columnCount
should return 1.

Change-Id: I96a1f83d3d5880e16b6553c515a619ff93f7d2a3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Artem Dyomin 2025-05-02 20:26:55 +02:00
parent 6ccee802a9
commit 878381473c

View File

@ -1301,7 +1301,10 @@ protected:
int columnCount(const QModelIndex &) const
{
// all levels of a tree have to have the same, static, column count
return Base::static_column_count;
if constexpr (Base::one_dimensional_range)
return 1;
else
return Base::static_column_count; // if static_column_count is -1, static assert fires
}
static constexpr Qt::ItemFlags defaultFlags()