Results 1 to 2 of 2

Thread: Vertical label on table horizontal header

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2012
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Vertical label on table horizontal header

    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:


    1. 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:
      1. if (!hv || hv->orientation() != Qt::Horizontal)
      To copy to clipboard, switch view to plain text mode 
    2. 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?

    3. 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.

  2. The following user says thank you to ipkiss for this useful post:

    davethomaspilot (11th February 2014)

Similar Threads

  1. Replies: 3
    Last Post: 20th January 2011, 13:24
  2. How to get vertical/horizontal zoom box?
    By knicewar in forum Qwt
    Replies: 3
    Last Post: 23rd March 2010, 04:09
  3. How to set two rows in a table view Horizontal header?
    By sivollu in forum Qt Programming
    Replies: 11
    Last Post: 29th April 2009, 04:57
  4. How to customize horizontal header (diagonal header view)
    By vairamuthu.g in forum Qt Programming
    Replies: 4
    Last Post: 4th September 2008, 15:59
  5. Showing Icon in vertical header of a table
    By vishal.chauhan in forum Qt Programming
    Replies: 7
    Last Post: 15th January 2007, 10:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.