View Full Version : QTableWidget - turn off heading separator

29th August 2014, 22:03

This should be quite simple but it is eluding me at the moment. I want to turn off the heading separator QTableWidget shows when you set the text for column and row headings. The default appears to be 3 little dots. Since I have user resizing disabled I would really like to either turn thise off or change it to be a continuation of the line.

qt 4.8 on Linux Mint 13

Application will eventually be built for an embedded target but I'm just tooling around with table stuff now in a stand alone application.


29th August 2014, 22:26
The default appearance is dependent on the theme in use.

There is no simple switch to render the QHeaderView without section borders and last time I checked it did not honour stylesheets either. You could look at what you can achieve the overriding paintSection(), but I suspect that this only has access to the area between the borders that are already painted. Reimplementing all of paintEvent() would be quite a lot of work.

Depending on your application, e.g. A fixed table, you might want to treat the labels as the first row/column of the data area rather than use the QHeaderView.

30th August 2014, 01:40
The default appears to be 3 little dots.

Are you talking about text eliding and the default 3-dot ellipsis that is inserted? That's not a heading separator. Look at QAbstractItemView::setTextElideMode() and set it to Qt::ElideNone.

30th August 2014, 16:47

It's not at the end of the text but between each row, instead of a line as is in the data grid. I had tried the ElideNone option and it had no effect. I would have "thought" it to use the grid lines as separators, but I've been warned about thinking before.

Thanks for the responses though.