Unsolved How to get width of a column in Qtreeview if I have column Name
-
I have columName , How to get width of a column in Qtreeview ?
For example if the Qtreeview has
A B C D as columns
I have B how to get the width of B
-
Hi
What about
int width = ui->treeView->columnWidth( index ); -
how to get index from columnName
-
Hi
Normally you would get that from a ModelIndex when you click something etc.
I don't think there is search by name.
You can loop them likeQStringList headers; for (int i = 0; i < ui->treeView->model()->columnCount(); i++) { headers.append(ui->treeView->model()->headerData(i, Qt::Horizontal).toString()); }