Hi,
I am trying to have the text on a horizontal header displayed vertically (i.e. rotated 90°).
I tried the implementation given here, but there are several issues. Here they are, ordered by increasing gravity:
- The vertical header is modified, not the horizontal one. This bug is easy to fix, we just need to replace line 12 with:
Qt Code:
if (!hv || hv->orientation() != Qt::Horizontal)To copy to clipboard, switch view to plain text mode- Even though I tried applying my new style only to a particular table (myTable->setStyle(myProxyStyle)), all the tables in the application are modified. How can I avoid that?
- Last but not least, the height of the horizontal header is not adjusted to take into account the size of the label. As a result, the text is truncated (and thus mostly useless). I tried two approaches to solve this problem:
- override QProxyStyle::sizeForContents(). I expected that it would be called for ContentsType CT_HeaderSection, but unfortunately it is not (it is however called for each view item, which doesn't help).
- override QProxyStyle::subControlRect(). I hoped that it would be called for SubControl SE_HeaderLabel, but it is not.
Does anyone have a suggestion about how to solve this problem?
Note: I'm using Qt 4.8.
Bookmarks