Results 1 to 2 of 2

Thread: QTableView: Simplest way to find the index of a column name in the horizontalHeader?

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Default QTableView: Simplest way to find the index of a column name in the horizontalHeader?

    Hi,

    I have a QtableView.

    What's the simplest way to find the column index of a QString in the horizontalHeader() ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableView: Simplest way to find the index of a column name in the horizontalHead

    Iterate over columns of the table and compare the string against the values from QAbstractItemModel::headerData() of the model connected to the view.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    govi2 (5th February 2017)

Similar Threads

  1. Replies: 2
    Last Post: 5th September 2010, 14:06
  2. Replies: 5
    Last Post: 29th June 2010, 11:58
  3. Model/View one index.column as hidden UserRole
    By doitux in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2008, 12:08
  4. Resizing QTableView's horizontalHeader
    By Jimmy2775 in forum Qt Programming
    Replies: 4
    Last Post: 20th December 2006, 00:14
  5. How to get current row(column) index in the QTextTable?
    By denny.t in forum Qt Programming
    Replies: 3
    Last Post: 5th April 2006, 07:53

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.