質問

I'm trying to write an exporter, which takes in a QTableView and writes all its data into a .csv-file, so it can be viewed in MS Excel.

Now I can't seem to find a way to read the text from the horizontal header's sections. There doesn't seem to be a method like QHeaderView::sections or something like that, so I can't access the QHeaderView's sections. There is a QHeaderView::count though, which makes me think that they are indeed saved in a container somewhere.

So is there a way to get the text of a section of QHeaderView?

役に立ちましたか?

解決

You should use ::headerData method of your model. To get number of columns you may use view->model()->columnCount(); method.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top