Results 1 to 4 of 4

Thread: How to set verticalHeader() indexing for QTableWidget ?

  1. #1
    Join Date
    Jul 2007
    Location
    Cluj Napoca, Romania
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Question How to set verticalHeader() indexing for QTableWidget ?

    So I have a QTableWidget. The vertical header has no labels set, therefore qt4 numbers the rows automatically from 1. I would like to set that numbering to start from 0 without having to make a new QStringList to use with setVerticalHeaderLabels and to update it frequently when a new row is added.
    How can this be done ?
    May the source be with you!

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: How to set verticalHeader() indexing for QTableWidget ?

    I am not sure, but what about QTableWidget::verticalHeaderItem? You could update the text for the last added item each time you add a new row.

    For example, when you add the first row, you update the header to display 0, not 1.
    I am not sure though how this works with updates, but I tend to believe it works.

    So each time you add a new row you only need to update the header for that row.

    Regards

  3. #3
    Join Date
    Jul 2007
    Location
    Cluj Napoca, Romania
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: How to set verticalHeader() indexing for QTableWidget ?

    Yeah I thought of that previously but I wondered if there is an easyer way.
    May the source be with you!

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: How to set verticalHeader() indexing for QTableWidget ?

    No, that is why you have setVerticalHeaderLabels.

    Regards

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
  •  
Qt is a trademark of The Qt Company.