Unsolved QHeaderView setSectionResizeMode "segmentation fault"
-
Hi. I need ResizeToContents for VerticalHeader. My attempt:
QHeaderView *vHeader = new QHeaderView(Qt::Orientation::Vertical, this); vHeader->setSectionResizeMode(Entity::SomeColumn, QHeaderView::ResizeToContents); ui->_tv->setVerticalHeader(vHeader);
And I get segmentation fault in this line: setSectionResizeMode.
How I can set heigh for my rows by context? -
I'm pretty sure it does not crash there but one line below. Please provide a minimal, compilable example to reproduce your problem.
-
The crash is probably caused by the fact that the view sections are not initialized until after you set the view's model. You must ensure that use of the two-parameter version of
setSectionResizeMode
happens aftersetModel
. Take it out of the view constructor and put it somewhere else.