Results 1 to 9 of 9

Thread: How to club column header's title for the QTableWidget

  1. #1
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question How to club column header's title for the QTableWidget

    Hi,
    I am using a QTableWidget where i have to set the name of 2 columns with the same name, ie column header for column 0 and 1 should be "Name". How can i club the header name for two or more columns???

    thanks & regards
    sudhish kapoor
    Last edited by kapoorsudhish; 18th November 2009 at 12:27. Reason: updated contents

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to club column header's title for the QTableWidget

    what do you mean with "club"?

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to club column header's title for the QTableWidget

    I think club has the meaning span, and there is no easy Qt way for that. You might want to have a look at HierarchicalHeaderView: http://qt-apps.org/content/show.php/...content=103154

  4. #4
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: How to club column header's title for the QTableWidget

    by clubbing i mean two columns having the same column name like we can merge columns in the excel sheet attaching the screen shot for the same.
    Attached Images Attached Images

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to club column header's title for the QTableWidget

    for the header there is no option. Is it inside the table use QTableView::setSpan().

  6. #6
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to club column header's title for the QTableWidget

    i am finding it confusing to use the setSpan() function, as to what should i pass to the function to achieve the attached image format. please help me in using the a above function.


    thanks,
    sudhish kapoor

  7. #7
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to club column header's title for the QTableWidget

    Quote Originally Posted by kapoorsudhish View Post
    by clubbing i mean two columns having the same column name like we can merge columns in the excel sheet attaching the screen shot for the same.
    This is called merging cells not merging columns.
    You can use QTextTable::mergeCells() for that.

  8. #8
    Join Date
    Oct 2009
    Posts
    66
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: How to club column header's title for the QTableWidget

    Thanks for the response but i actually want to merge the columns like two columns having the same heading. i dont know which function to be used for sure i dont want to merge the cells but i want to merge the columns headers for two cells.

    thanks,
    sudhish kapoor

  9. #9
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to club column header's title for the QTableWidget

    Quote Originally Posted by kapoorsudhish View Post
    Thanks for the response but i actually want to merge the columns like two columns having the same heading. i dont know which function to be used for sure i dont want to merge the cells but i want to merge the columns headers for two cells.

    thanks,
    sudhish kapoor
    Your screen shot and verbal requirement is contradictory. In image I cannot see any merged columns. Are you sure you want to achieve the screen shot thing? If yes then its merging cells.

Similar Threads

  1. QTableView + column span of headers
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2009, 14:29
  2. Replies: 2
    Last Post: 12th April 2007, 11:11
  3. Replies: 0
    Last Post: 10th November 2006, 13:46
  4. hidden QListView column suddenly visible
    By edb in forum Qt Programming
    Replies: 10
    Last Post: 27th January 2006, 08:00

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.