PDA

View Full Version : QHeaderView eliding versus font size



davethomaspilot
2nd February 2013, 01:40
When I use a style sheet to define a font-size larger than the default for a QTableWidget's horizontal header, the text gets cropped. This happens regardless of whether I elideLeft, elideMiddle, or elideRight.






QString header_styleSheet = "::section {" // "QHeaderView::section {"
"spacing: 1px;"
"background-color: orange;"
"color: purple;"
"border: 1px solid purple;"
"margin: 1px;"
"font-family: arial;"
"font-size: 18px; }";

splitTimes->horizontalHeader()->setStyleSheet(header_styleSheet);


Here's what the header looks like with 18 px font:
8673

versus a 12 px font:
8672

It's like the eliding code isn't aware of the font-size that was applied with the stylesheet.

I saw the same type of thing for horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);

Is there something I need to do to change the horizontal header font size other that using a style sheet to avoid this?

Thanks,

Dave Thomas