Results 1 to 3 of 3

Thread: Custom QHeaderView in Qt 4.1.1

  1. #1
    Join Date
    Jul 2006
    Location
    Almaty/KAZAKHSTAN
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Custom QHeaderView in Qt 4.1.1

    Hi guys!

    I'm using Qt 4.1.1 and have come across an unsolvable (at least to me) problem:
    Normally text in sections of horizontal header view are drawn horizontally.
    The question is - how to make that text drawn vertically, i.e. rotated by 90 degree? (see the attachment picture)
    I've tried this:
    Qt Code:
    1. class MyCustomDelegate : public QAbstractItemDelegate
    2. {
    3. ....
    4. public:
    5. void paint(...){
    6. doMyCustomPaint();
    7. }
    8. };
    9. ...
    10. // usage
    11. tableView->setModel(myModel);
    12. myCustomDelegate = new MyCustomDelegate(this);
    13. tableView->getHorizontalHeader()->setItemDelegate(myCustomDelegate);
    To copy to clipboard, switch view to plain text mode 
    But code above does not help. Have any idea?
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Custom QHeaderView in Qt 4.1.1

    QHeaderView is not a full-featured model-view class and doesn't unfortunately use item delegates for anything at all. Check this thread.
    J-P Nurmi

  3. #3
    Join Date
    May 2006
    Posts
    28
    Thanks
    8
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Custom QHeaderView in Qt 4.1.1

    I've got a similiar problem, I'd like to rotate some QPushButtons and place them vertically, similiar to Amarok or Kate sidebars on KDE.
    I have looked at the Amarok source code 'multitabbar.cpp' and it subclasses the QPushbuttons and on a paint event it rotates them 90 degrees.

    I wonder if this is the right way to go.

Similar Threads

  1. Custom plugin for a layout
    By cocheci in forum Qt Tools
    Replies: 2
    Last Post: 12th June 2006, 18:36
  2. Replies: 4
    Last Post: 24th March 2006, 22:50
  3. Custom Qt dll name
    By tony007 in forum Installation and Deployment
    Replies: 2
    Last Post: 10th March 2006, 15:29
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. Replies: 4
    Last Post: 1st March 2006, 23:11

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.