Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[solved]get the index of a hiddencolumn



  • hello
    so i used a qtableview to show the data in a table of database when the data show a column be hide but the poblem that i want to get the index of the hidden column if it's possible



  • what did you do to solve this problem?



  • hello Overtime
    so firstly the column that i want not to show i hide it by using @setColumnHidden(0,true);@
    the problem was that when the user select a row the index that i get it's the index of the second column and not of the first column that i hidde so to solve the problem i Followed this steps i create a @QModelIndex index
    @ this index will contain the index of the second column @index=ui->tableView->currentIndex();
    int test;
    test=index.row();@ and it's not what i want so i used this code @index = index.sibling(test, 0);@ to post the number of column that i want and here it's 0 also to post the the row value here it's test
    hoppe that's help you


Log in to reply